Minor improvements

@muan For non trivial changes, the reason for the change is explained in the commit message.

Take what you consider useful. Hope it helps!