Tidied up various source files to reduce number of non-fatal warnings on compilation

