added curve fitting functions