created 'tnet' function