implement clear date and add more functions to divided the code