add test to make sure we can write and round trip
move writing state machine to numeric constants
rename name_pack to namePack
split writing up into smaller functions