do master() and slave() functions