initial code porting complete