Templates reconfigured, better markup, and error handling