Fixed comments
Code refactoring

Merged mb_publish_host_check() and mb_publish_service_check() functions
into mb_publish_check(); also refactored some error handling code.