Some minor refactorings