Added unsaved changes check