Converted to coffeescript