Added threading waiting for testing.