Debugging code added and set union changed to set intersection