cleaned up with jshint.com