rewrote rank api