change structure to suit coffeescript better