refactoring index_finger_detector.cpp