Ongoing polygon work.

Rewrote the whole thing to take a different approach.