Ring buffer

Ring buffer functional