Merge pull request #824 from jmaas/master

More cleanup + fix in templar code