need to improve clear function