Cleared up build warnings.

The code has been cleaned up to prevent any warnings during build.
Unused/unreachable variables/code have been commented out.
Where variable hiding occurred the new keyword has been added.