Made the pipe code more modular for future pipes.