Frontend templating

Lots of edits here.
you probably mean `if (err) return callback(err)` here