add pseudo code for flow