Change condition to use relative rank

No functional changes