Added exit flag to clean