Initial version with all tests passing.
Add template tests.