rolled our own circ buffer