Refactor: make Digit class a module