Moving global vars to a better place