Added tree partitioning

Also fixed the wall recognition "bug" in isTooClose, along with some
basic wiring