Added multithreaded testing and debugged subsequent erros.

MPMC queue almost done - needs valgrind check.