Factor out pipe methods, add takeOwnershipOfPipes