ported over interval-tree data structure and unit tests