Initial multiprocessing support and some cleanups