Refactored walk engine to use doubles and split logic into methods.