Making more serialization generic