Make this a Set - so the subsequent comparisons against it are O(1).
Ofcourse, considering the really small size of all of these datastructures, the optimizations might be moot.


The recomputation of preferredLocations is obviously something which be avoided ofcourse.