renames vars and beefs up comments to make things easier to follow