Added state handling.