refactor for jslint