porting to nodejs