implement and test the Walk function