You declared product twice, and you refer to productTotal and salesPersonTotal when they are out of scope. Try changing the second product variable's name (or use the same variable if that's okay with your solution), and try declaring productTotal and salesPersonTotal one scope block up.