Refactor fit_wls a bit