added flash message and redirect