Refactor flash alerts