I think this can be made easier to read and more concise using set operations like retainAll?