Improved DDEfunction

The program is faster compared to the last commited program.
Dead time has been incorporated.