split out common code for both pipeline designs