refinement: reduce branching.