fixed jshint errors, cleaned up code, and refactored a couple methods