implement Flash function