Remove cleanup and deglobalize and rework data structures