Get rid of gob encoding
Fix typo
Refactor to be more concise