add code to TDT logic
updated code for TDT logic