Change walking method to 'while'