added pipes to send data between threads