Added all_paths function