Refactor APIs to use automatic serialization/deserialization.