added dynamic buffer