Bug fix for previous commit

Added variable declarations back to code.

Look before you leap, and test before you commit.