Cleanup: Rename function

This will allow future refactoring since the exact same code is
used in several places across the codebase.
Move templates to templates/ directory

Fixes #11