Implemented tags serialization/deserialization.