update variable names and comments for clarity