Implement multi-thread support