Clean up duplication in Pipeline

Clean up code duplication in Pipeline creation.