Implemented average ranking and merge sort