Clean up global state variables