Added fit algorithm.