Minor changes, implemented BufferThread