Better state handling.