Changes to work correctly with Heroku, fixed so that the appropriate environment variables are defined and used.