Refactor walk() to module.