coffescript refactor