Wrote function for flash removal