Changed HashSet to TreeSet