added flash middleware