rewrite js to coffee