added ewyk version with state machine