Array encoding, and more tests