One more update: users not raised on *nix systems sometimes insist on having spaces in their usernames, despite advice to the contrary. My script was broken as it did not handle that case properly. I updated the script so that user names with spaces in them do not cause any trouble.