rewriting js to coffee