Addition of template tag and minor bug fixes