added some functionality to the doForEachPlosDoc function. Also removed a bug which caused the onTBDB Boolean to have a false value