Add validation and serialization.