refactoring
prevWord working. Nicely DRY code too.