some ordering function for Ids