changed container from vector to set
corrected bug in if