Added adaptive bkg for edges