Wrote a lot of (untested) code while sleepy

The majority of this code is mostly untested, so I can really only vouch
for how volatile it must be.

Oh, I also bumped into the max number of threads. I wonder if there's a
similar limit for threads when multiprocessing...?