First stab at threading abstraction.
Can now use multiple threads.
Producer thread made a lot more efficient.