lecture 4 : templates and singletons