more cleanup and restructuring