added Trend class and its functions