Lots of clean-ups of code warnings etc