gettrack_with_classes.py optimizing nearest point function