Fix flash handling to be vastly simpler.