Flash algorithm fixes and enhancements.