put in mongoose stuff for heroku and cleaning up some code