Simplify interface of Google examples and fix the name and comment of userName variable

Any way to combine both of these try blocks, since it's basically the same error message?