cleanup sample function