refactored key cleaning in facet handler