More code clean-up. Remove all globals.