stepped back to before heroku files were added; improved error handling