Better logging, and safer username handling.