converted source JS to coffeescript