Refactor ToFDetector class