first multi-threaded version that actually works