refactor flash message