made some optimization changes
Merge https://github.com/akhilrex/DMP_New