begining of creating rankSort