Add fit method and tests.