Minor code refactorings