Implement Snak serialization and unserialization