got threading working correctly