write_tet added (unfinished work)