added some fitting routines