Refactored code to have more clear variable name and comments