add a customizable templating system and lots more restructuring