refactor with coffeescript