refactor for Heroku deploy compatibility