better comparison function in sorting rankings