Trend estimation module. Refactor is needed