Made the buffer thread local, which should solve most of our thread safety issues.