rename variables and adjust code