Refactor to use buffers and add a few tests

Use proper buffer deserialization of bytes via Buffer.