Change directory walking to use and_then