refinement: reduce branches.