Refine the implementation of ReferenceOnlyFilter.