Refactor the Filter component