Change serializing algorithm