added a recursive walk function