Refactor out some globals.