ported to coffeescript