Added rank calculation to bubbleSort