refact adding sorting reply