refactored flash messages