Ran through jshint.com and cleaned up code.