Turn on -Wall and remove unused variables

Remove several unused variables throughout the code.