Add error handling and templates.