refactor. rename variables and remove unused variables