Refactored and cleaned up terminal partitioning code

Now all tests pass.

Ditched out a fair bit of unused functions in meta-var processing.

Also updated docs (ha-ha).