Added detrending by preserving the mean