refactor. graceful exit with SIGINT.