Get the offset counting correct for captures
Fix where table.insert puts value when inserting last
Improve update_val to never check if tree needs rebalancing