Major rewrite of the program, using return statements as the flow control instead of a single program