Making filtering more efficient