changed arraylist implementation to hashset