Refactored template specific code into its own file / object