replaced sorted vector with set for clarity