Implements pipe creation logic.