added functionality for flash messages