Converted to coffeescript and removed debugging