modified according to jslint errors