Misc cleanups

@fosdev Please review and merge!