Prepare for sorting