Updated code for newer tAPI