Cleanup and better marked where global is being used