Try to catch most exceptions in a reasonable way. Simplify handling of usernames.