added counted circular buffer template