implement tunnel trimming