updated scope algorithm