merge the flow, implementing logout