First pass on the sequential algorihm.