cleaned up some code to pacify jshint