Partial refactoring.