Some refactoring.

I really like the changes you did in the meanwhile :thumbsup: 

While reviewing I stumbled on some refactor possiblities.
See single commits for details.

Feel free to cherry-pick.

I can stash them later if you like :smile: