Refactored word handling to use discriminated unions
Refactoring of domain logic