Phase 2, move globals to classes.