changed clear logic