DWT modularized code added