Heroku

Added support for Heroku. Also a variety of bug fixes.