def do_bls_and_fit(time, flux, min_period, max_period):
	S = clean_and_search.Search(time, flux + 1, np.ones_like(flux)*1.E-5)
	S.do_bls2(min_period = min_period,
			  max_period = max_period,
			  min_duration_hours = 1.5,
			  max_duration_hours = 6.,
			  freq_step = 1.E-4,
			  doplot = False,
			  norm = False)
	guessDict = {'period':   S.periods[0],
				 'T0':       S.epoch}
	freeParPlanet = ['period', 'T0', 'rprs']
	fitT = fitModel(time, flux, guessDict, freeParPlanet)
	# Readability of output data
	period = fitT.fitresultplanets['pnum0']['period']
	epoch = fitT.fitresultplanets['pnum0']['T0']
	k = fitT.fitresultplanets['pnum0']['rprs']
	rho = fitT.fitresultstellar['rho']
	duration = computeTransitDuration(period, rho, k)
	if not duration:
		duration = S.duration * 24
	# Calculating transit depth significance
	## fitT.transitmodel sometimes has a NaN value
	sigma = computePointSigma(time, flux, fitT.transitmodel, period, epoch, duration)
	depth = k ** 2
	significance = depth / sigma
	phase = getPhase(time, flux, period, epoch)[0]
	nTransitPoints = np.sum((-duration * 0.5 < phase) & (phase < duration * 0.5))
	SNR = significance * nTransitPoints**0.5
	return SNR, period, epoch, duration, depth, fitT.transitmodel, S.f_1, S.convolved_bls