working on master/slave detect