refactor clear method