I'd rather see this function defined elsewhere. Right now you're recreating it every time isDirty is called.