added flash messages for success and fail