created a ring buffer that uses head and tail - warning it is partly b0rked