Changed how message type is set

Changed the if...else blocks so less typing is required by the
programmer.