added templating logic. If a module has a template shipped with it it uses that template, if not a core one is used