slave mode code added