begin encoding, tests fail/skipped currently
rename to decode.go