Now more optimized.. uses HashSet instead of Arraylist.