added sorting by priority to ready_list