Circular buffers contributed by Kiril