Clean up flashing code

Hasty commits from the wilderness are bad plans!