basic program flow (not tested)