Fixed lots of bugs and got this working with the new Templating system.