Fix interval_tree so it actually works. Add unittests.