417 unused code rules fix

Dealt with most UnusedLocalVariable and UnusedFormalParameter warnings.

Addresses some of #417.