more refinements to rankikng algorithm