working get_fit function