Converted JS code to CoffeeScript.