Move some global 'flags' to individual variables.