attempt to refactor clear_all