adapting to heroku's use of varying port numbers. also pruned some commented code.