TEST moving rank outside loop