draft of haar wavelet and sorting