add generic fitting function