Refactor of flash messages