renamed a few variables for readability