Simple threaded version.