[imp] improved sorting formula