consolidate flash logic