Modified CORS code block at bottom to make it heroku compatible, per Jason.