trying to deal with reading and writing to pipes problems.