refactor flash message for actions