Moving javascript to coffeescript