Fixes to Write(), big changes to NewRingBuffer, new logging (see script example)