Refactor for algorithm changes and better legibility.

Removed code for decimation and boolean joins, may add back in later.