implementing wavelet