Reorganized the message handlers into a map of functions, split the random string generator to a separate package.