implemented parsing for templates