refactor to coffeescript part1