Fixed UpToSet to incorporate ranges