Implement the feature of circular buffer