simplified endpoint_tree handling in inserting lines