Controlling the flow of a script