Finished fitting algorithm