More cleanup on threading