Moved username handling from lib to cmd.