This looks nice, but i see no reason the worker get randomly generated users-name, whats wrong with username.<xyz> and <abc> type workers?
(where xyz is usually 1 2 or 3 etc and abc is x in my case)
that's because your name can be changed in the system, so we've got to get your workers bound to your ID instead.
though second part of worker name and its password can be changed anyway.
sorry for the inconvenience.