Improved the flash middleware example