Split fitting function and solver into different classes.