change the algorithm of subject_arrange