added flashing code