hangman game refactored