Changed queue to ringbuffer array.