Added rank function, only problem is if no rank, does not rturn. (OK, I guess)