lots of modification to make the app run on heroku