cleaning up and fixing bugs in new TDL