how to do sorting