add resolveSort function