More template refactoring.
Merge pull request #29 from sdmp/master

More template refactoring.