Added hand_rank function and test cases