now sort function use ctx information