More work on bytearray streams & add unit testing