Refactor some intermediate variables for clarity