adds setting master IP as parameter; refactoring