now using threads with stop events