replace GPR process by a state machine