Replace State enum by global variables