Change HashSet to LinkedHashSet to avoid ping-pong problems