add the commented way of doing an intersection instead of union and clean up the code a little