Rename template to allow for easier metaprogramming
Use metaprogramming to refactor three similar methods into one