improvement of digit recognition script