Rewrite in coffee script