MSVC Compiler Compatibility

The MSVC compiler requires variables to be declared at the top of the block (before any code), so this patch shifts the point where a couple variables are declared to enable MSVC compatibility.
Merge pull request #1 from jrmash/master

MSVC Compiler Compatibility