refactoring hangman