added modifications so that collecting counts to be done for each read Result object as it is read, not for all after reading them