upadted Tedges function. added Nedges