Refactory and decode/encode struct by gob interface