Implement more multi-threaded API, fix initial API mistakes