More tests, better ToByteArray