Rename variables and format code