Code cleanup

This is a pretty big change.

I've bought down the amount of warnings from around 280 to 173. Some warnings must be suppressed as they can't be avoided easily.
Line is too long. [133/120]