More template changes.
Added more test cases and made some changes to the template verifier.