Adding exceptions to template parsing and removing unneeded code