state handling cleanups