cleanup and reorganization