use set.discard instead of set.remove