Misc refactoring, mainly cosmetics.