Moderate refactoring.