further porting, still a lot to port