Complete logic for hangman