added a ringbuffer implementation