changed array to hashset and fixed creatin thred bug