Used http://www.dirtymarkup.com/ to clean up JavaScript