Wouldn't this whole section make more sense structured as a single-pool helper can be called as many times as necessary, instead of interspersing the control flow logic with the output logic?