Refactor variables and loops.

refs #2589