Refactor clear method.