Beautified code, ran through jslint and corrected code to latest JS standards.