added threaded api wrapper