Changes after code review. Fixed jslint errors.