readMines and writeMines function working