Needs debug for the rank