Extracted more common code to PipelineHelper.java