made a couple of tweaks based on suggestions by jslint