Converted from CoffeeScript to JavaScript