Add ring buffer implementation