statemachine working now in simple form