implemented pipe swap