add middleware.  Change serialize.