Restructure for porting