Misc small stuff

Sanitisation, fixes, cleanup (see commits)