Refactor internals of HashFilter