Simplifying code, rename variables and adjusting