update clear logic