apply sort