Correct almost all compiler warning issues
Merge pull request #383 from RichardHitt/warnings

Correct almost all compiler warning issues