Refactor S3 & Heroku support