Warning fixes v3

This fixes a series of warnings across the system. Please perform a careful code review, then merge at will.
Can we please enforce the 120 char per line limit at least for new lines? :smirk: