Added better code for flash statement. All tests pass