made stoneDetector a function