refactored code to make variables more readable