changed coffeescript to javascript