Some nice refactoring.