renaming some variables to clarify code