distance sorting finished