Minor tweak to algorithm to find a background flat.