test gob encoding & tiny refactor