rename main functions of master and slave. Now names reflect main idea of functions