Made several changes to take advantage of the new fitting possibilities (API change)