Some refactorings

Please, review #35 first as this branch builds on the other.

This PR consists of only loosely related commits, most of them only propositions. We should cherry-pick, what we agree on.