for fitting and plotting