convert code to coffeescript