added state machine to sessions