code cleanup to pass jslint