Updated GateStateHandler.cs