updated sorting based on status
sorting after inserts