Refactored all the code to make things a little more sane.

re-engineered to be object oriented instead of functional
this allowed me to more easily integrate the new features of being able to load uncompiled templates and recompile them in the client.

i also abandoned the idea of not creating a duplicate of the exported template object which is typically created when compiling templates for use later to make recompiling and accessing the templates easier.