Starting to write find_fit and address some bugs