converted coffeescript to standard js