Rename variables to match convention. Move location of rank formatting.