Better operation selection algorithm