modified for parameter fitting
modified for parameter fitting