second round reorganized code