clean up state