updated HashSet usage and clear