Adapted to CoffeeScript.