add buffer and loop