refactor basic functionality for hashset