Refactored iterative solution.