Refactor to support new prepared statements logic in DT