changed name and made code slightly more concise

got rid of unneeded variables and made code slightly more readable