porting and cleanup and root