Removing unused variables and cleaning up the code.
Suppress warnings, fixing use of raw types etc.