Major reorganization and cleanup.