Code rewritten in CoffeeScript.