Minor cleanup
Lots of work on cleaning up template