Updated to use detrended data