Switched to jshint, cleaned up code