Modified to shuffle directions to avoid unbalanced search.