redesign to use []byte not bytes.Buffer