add more tests, clean up templates