refine digit input, implement clear