Final refactoring.