Added some helper functions and some basic parsing of messages.