Clean up send()'s data serialization algorithm