made example code flow better