improve fitting functions generating