initial conversion from js to coffeescript