initial memory stream implementation