For your repeat I would add a procedure that sets all values to default/0 and then put your entire main program into a main() procedure. That way between the begin and end of your new program all you will have is

Code:
begin
   repeat
      SetDefaultValues();
      Main();
      until ApplicationClose = True //or whenever you want the program to end.
[/CODE]