added code for using convolution theorem instead