refactor rank to ranking, refactored ranking api