Added simple support for multiple threads