Modified the IsDirty logic