Refactoring to remove complexity.