adding buffer size handling and correct pipes