Implemented a better template engine