Some review and refactoring.