Code review and refactoring.