Refactored CompiledTemplate to represent a function. Introduced Compiler to handle parsing of the template and create CompiledTemplates where needed