digits to numbers refactor