Updated to deal with reads of unknown size