refactor code && abstract rank api