refactor js file to coffee