Refactored methods in hangman.rb