Fixing logic in main function involving master IP address.