porting to ruby