Refactor for heroku