updated the flow of control