Working out the state stuffs