added linear fit routine