general cleanup and restructuring