refactoring the buildFacet function