add function to rank