added templater
Merge branch 'master' into templater
refactored templates into functions
finish templating
Fixed template function