Adding example3 (threaded version of example2)