Refactoring to use a separate walk method