re-organized some of the templating