Fixed jslint issue and added tests