Big update. fied encoding for array types. Implemented encoding for reference types.