Small improvements

Scan first TDs if there are no THs
Add function delete_until