refactored variable name, changed spacing on if block