Clean up template prior to rendering. Fixes for issue #35