Rename variables and performance optimization