Code refactoring for filtered facets