ran jslint and cleaned up code