modified the rank method