changed calculate rank
g