better model serialization process