add the rank logic

add the rank logic