revising pseudo-algorithm, as per discussions on www-style
machine-generated version