added a manual convolution function