move all js code to coffee file; delete the copy/paste code form stackoverflow