unified code paths in sort tool