added flash message functionality