Minor refactors

As the title suggests.

Some stuff that bugged me a for some time, some stuff CodeClimate complains about, some other minor stuff I stumbled upon.

Comments, additions, corrections are welcome.