duplicate tet removal function