ENH:  Complete rewrite.