Reciever state machine