Updated IsDirty logic