changed use of reads function to read function, reads was hanging indefineitely