refactored variable names and comments.