Removing extraneous allocations, fixed search predicate