Some code refactorings.