Rename variables and remove some debugging code