Frontend templating

Lots of edits here.
you are missing an error handler here