Moved message handling code into messageHandler function for
reusability.
Updated help printout and add support for "--help".
Code now conforms to the style guide.