Added a state machine class. Fixed typo in netManager.cpp