Minimal refactorings

These are some minor refactorings I found while looking through the source. Some might be opinionated, but I'm glad to revert any changes you might disagree with.