Correctly declare/use global state variables