3AM hacks to make this multi-threaded.