swap state and message