ex4: implemented fit to 'bad' data