diff --git a/Data/GPS/Trail.hs b/Data/GPS/Trail.hs
--- a/Data/GPS/Trail.hs
+++ b/Data/GPS/Trail.hs
@@ -11,13 +11,14 @@
          -- * Trail Functions
          -- ** Queries
        , totalDistance
+       , totalTime
        , avgSpeeds
        , slidingAverageSpeed
        , closestDistance
        , convexHull
          -- ** Transformations
---       , bezierCurveAt
---       , bezierCurve
+       -- , bezierCurveAt
+       -- , bezierCurve
        , linearTime
        , filterPoints
          -- ** Grouping Methods
@@ -33,10 +34,10 @@
        , unionOf
        , refineGrouping
        , (/\), (\/)
-       --  -- ** Composite Operations (Higher Level)
---       , smoothRests
---       , smoothSegments
---       , smoothPath
+         -- ** Composite Operations (Higher Level)
+       -- , smoothRests
+       -- , smoothSegments
+       -- , smoothPath
          ) where
 
 import Text.Show.Functions ()
@@ -83,18 +84,17 @@
 slidingAverageSpeed :: (Lat a, Lon a, Time a) => 
                        AvgMethod a -> NominalDiffTime -> Trail a -> [(UTCTime, Speed)]
 slidingAverageSpeed _ _ [] = []
-slidingAverageSpeed m n (x:xs) =
-    let avg = getAvg (x:xs') m
-        avgTime = getAvgTime x (fromMaybe x e)
-    in case avgTime of
-	Nothing -> []
-        Just t  -> (t,avg) : slidingAverageSpeed m n xs
+slidingAverageSpeed m minTime xs =
+  let pts   = map unSelect (spansTime minTime xs)
+      spds  = map (getAvg m) pts
+      times = map getAvgTimes pts
+  in concatMap maybeToList $ zipWith (\t s -> fmap (,s) t) times spds
   where
-  (e,xs',rest) = takeWhileEnd (\c -> getTimeDiff c x <= Just n) xs
   getTimeDiff a b = on (liftM2 diffUTCTime) getUTCTime a b
   
   --  getAvg :: [] -> AvgMethod -> Speed
-  getAvg cs m =
+  getAvg _ [] = 0
+  getAvg m cs =
     let ss = getSpeedsV cs
     in case m of
         AvgMean -> mean ss
@@ -107,12 +107,15 @@
           in if V.length ss' < 3
              then mean ss'
              else if odd len then ss' V.! mid else mean (V.slice mid 2 ss')
-        AvgEndPoints -> fromMaybe 0 . join . fmap (speed x) $ e
-        AvgMinOf as -> minimum $ map (getAvg cs) as
+        AvgEndPoints -> fromMaybe 0 $ speed (head cs) (last cs)
+        AvgMinOf as -> minimum $ map (flip getAvg cs) as
         AvgWith f -> f cs
+  getAvgTimes [] = Nothing
+  getAvgTimes [x] = getUTCTime x
+  getAvgTimes ps = getAvgTime (head ps) (last ps)
   getAvgTime a b = liftM2 addUTCTime (getTimeDiff b a) (getUTCTime a)
   getSpeedsV = V.fromList . getSpeeds
-  getSpeeds zs = concatMap (maybeToList . uncurry speed) $ zip zs (drop 1 zs)
+  getSpeeds zs = concatMap maybeToList $ zipWith speed zs (drop 1 zs)
 
 type TrailTransformation c = [Selected (Trail c)] -> Trail c
 
@@ -371,6 +374,10 @@
 -- | Find the total distance traveled
 totalDistance :: (Lat a, Lon a) => [a] -> Distance
 totalDistance as = sum $ zipWith distance as (drop 1 as)
+
+totalTime :: Time a => Trail a -> NominalDiffTime
+totalTime [] = 0
+totalTime xs@(x:_) = fromMaybe 0 $ liftM2 diffUTCTime (getUTCTime x) (getUTCTime $ last xs)
 
 -- | Uses Grahams scan to compute the convex hull of the given points.
 -- This operation requires sorting of the points, so don't try it unless
diff --git a/gps.cabal b/gps.cabal
--- a/gps.cabal
+++ b/gps.cabal
@@ -1,5 +1,5 @@
 name:		gps
-version:	0.8.0.1
+version:	0.8.1
 license:	BSD3
 license-file:	LICENSE
 author:		Thomas DuBuisson <thomas.dubuisson@gmail.com>
