implemented clear function