change vector to set, in order to avoid hanging on loop