preparing for sorting