adding buffer management