Implemented clear() function.