main should exit when done