working on proper prog exit