sped up flushing and efficiency
fixed bug? in indanger code; flipped true to false; requires testing