Implemented new state machine, to make networking faster.