now works from thread!