Added presid calcuting functions
Merge branch 'presidual'