this differs from the first version only in its structure, not in its operations

next(n,pdone)