added code for convolving channel and d