Refactored MineSquare.