Clean stuff

A lot of small fixes and cleanups not really related.