Added support for handling tags
Fixed parseTemplate call