Added graceful exit