Clean up threading stuff