@Override
    public Optional<Track<T>> clean(Track<T> track) {

        TreeSet<Point<T>> points = new TreeSet<>(track.points());

        Iterator<Point<T>> iter = points.iterator();

        LatLong anchor = null;
        Instant anchorTime = null;

        while (iter.hasNext()) {
            Point<T> point = iter.next();

            //the 1st time through this loop set the anchor information
            if (anchor == null) {
                anchor = point.latLong();
                anchorTime = point.time();
                continue;
            }

            if (tooCloseInSpace(anchor, point) && tooCloseInTime(anchorTime, point.time())) {
                iter.remove();
            } else {
                anchor = point.latLong();
                anchorTime = point.time();
            }
        }

        return Optional.of(Track.of(points));
    }
@Test
    public void testTrackWithPause() {

        Track<String> track = trackWithPause();

        Track<String> cleanedTrack = (new DistanceDownSampler<String>()).clean(track).get();

        int numRemovedPoints = track.size() - cleanedTrack.size();

        assertEquals(
            901, track.size(), "1 seed point + 300 moving + 300 stagnant + 300 moving"
        );
        assertEquals(
            290, numRemovedPoints, "Of the 300 stagnant points only the 10 heartbeat points should remain"
        );
    }