simplify flow logic