implemented PipeDistance