Moved diff code to serializing step