Template refinements

Resolves issues #72, #74, #79 and #80.