Changed variable name and refactored code.