analytics and cleanup