new rank algorithm