Modified the check_for_messages function to indicate the status of the buffer without requiring the output pointer to be specified elsewhere