made the code pass jslint tests