core algorithm improvements to use switch

uses switch statement to iterate over each filter relation. Improves
performance some more