Table and array encoding, and some tests.