Replace arraylist by hashset in filter, which should improve performance