Changes to speed up the rank sum calculation