added curve fitting