Refactor: rewrite as reduce