porting many more functions