added fitting functions