major cleanup and reorganization