Added a serial mode so that it can be easier to cope with multithreaded environments.