Small fixes

Miscellaneous, small changes.
Reasoning behind each of them is provided in its commit, and should be discussed there.

Some changes are API cleanout, they break compatibility.