refactor, merge ser & deser to codec