Added function checkConnection(currentPipe)

Struggling with connection logic.