formatting fixes and variable renaming