Rewriting ring buffer to use pointers instead of indices. Currently it is a mess and cannot be built. Will resume work later today or tomorrow