Revise DWT implementation