Introduce fit function