Updated doc, modified statemachine