Added linear detrending