Progress on threading. Still needs work.