Removed redundant schema, added catch to getTemplate.
Added some more comments, tidied up some logic of isUserInGroup.