code readability improved in $$addStateInChain