added linearCalc function