changed clear function