Rename variables and add comments for refactoring