Updated the python script to be more friendly with Heroku.