Hello!
Thank you for making it look nice and answering 
That was indeed the main confusion!
However, the last two lines shown on the code I posted here still give an error, somethin with  broken pipe 
Do you also have any idea on that one?
Thanks so much.