printing results before exiting