Some minor refactoring per feedback.