Added Template Engine

Restructured code to allow for a flexible templating engine.
Updated documentation for templating

Basic templating documentation