Be aware that you can save memory by removing `lo`, `hi` and `split` from the tree and computing them as you go (you need to pass the size of the whole tree in at the top - so it can be handy to create a wrapper structure for the tree itself, with a pointer to the root node). You can also eliminate `stale` by updating `mval` at the bottom of `modify`.