Created parse function for message