porting client code from js to coffee