move all clearing in clear_all, add some comments