Added template helper functions and some template tags