Change set.clear() to set.remove()