Added buffer management stuff