Implemented ringbuffer.