working on the buffer management