code reformatting and renaming some variables