Complete rewrite from the ground up.