Rename variables and organize the source code