added detrending per @lawinslow 's suggest