Performance improvements, modified code to be thread safe, reduced a few
memory allocations.