Got rid of template files.

Should have been using them anyway. Templates appear to be made for
RESTful API use.
Begin error handling?

More work on setting up error handling using cookies. This is probably a
bad idea.
Cleanup of header setting code

Cleaned up the code to set headers on response. This is probably as
close to the "right way of doing it" as I am going to get for the
foreseeable future.