<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -47,9 +47,9 @@ class Mapper
   end
   
   def isochrone(stop, time)
-    @best_times = {stop.stop_id =&gt; time}
+    @best_times = {stop =&gt; time}
     @stack = [stop]
-    while !@stack.empty?
+    until @stack.empty?
       traverse(@stack.pop, time)
     end
     @best_times
@@ -60,7 +60,7 @@ class Mapper
       stop.available_hops_after(time).each do |hop|
         if @best_times[hop.destination].nil? || @best_times[hop.destination] &gt; hop.arrival_time
           @best_times[hop.destination] = hop.arrival_time
-          @stack &lt;&lt; stop(hop.destination) #ouch, that's inefficient
+          @stack &lt;&lt; hop.destination
         end
       end
     end
@@ -86,7 +86,7 @@ end
 class Hop &lt; OpenStruct
   def initialize(from,to)
     super :departure_time =&gt; from.departure_time, :arrival_time =&gt; to.arrival_time,
-          :trip_id =&gt; from.trip_id, :destination =&gt; to.stop_id
+          :trip_id =&gt; from.trip_id, :destination =&gt; to.stop
   end
 end
 </diff>
      <filename>mapper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -17,23 +17,24 @@ class MapperTest &lt; Test::Unit::TestCase
     assert_equal 2, m.stop(&quot;STAGECOACH&quot;).available_hops.length
     
     stba_hop = m.stop(&quot;STAGECOACH&quot;).available_hops.detect {|hop| hop.trip_id == &quot;STBA&quot;}
-    assert_equal &quot;BEATTY_AIRPORT&quot;,      stba_hop.destination
+    assert_equal &quot;BEATTY_AIRPORT&quot;,      stba_hop.destination.stop_id
     assert_equal Time.parse(&quot;6:20:00&quot;), stba_hop.arrival_time
     
-    assert_equal &quot;NANAA&quot;, m.stop(&quot;STAGECOACH&quot;).available_hops.detect {|hop| hop.trip_id == &quot;CITY1&quot;}.destination
+    assert_equal &quot;NANAA&quot;, m.stop(&quot;STAGECOACH&quot;).available_hops.detect {|hop| hop.trip_id == &quot;CITY1&quot;}.destination.stop_id
   end
   
   def test_isochrone_creation
     m = MapperFactory.new('sample-feed').mapper(Date.new(2008, 11, 18))
     nanaa = m.stop(&quot;NANAA&quot;)
+    assert_not_nil nanaa
     # This is the default trip that Google's demo agency shows...
     # http://www.google.com/maps?ttype=dep&amp;saddr=North+Ave+at+N+A+Ave+Beatty,+NV&amp;daddr=W+Cottonwood+Dr+at+A+Ave+S+Beatty,+NV&amp;ie=UTF8&amp;f=d&amp;dirflg=r
     # 6:07am	Depart North Ave / N A Ave (Demo)
     # 6:26am	Arrive E Main St / S Irving St (Demo)
     isochrone = m.isochrone(nanaa, Time.parse(&quot;6:07:00&quot;))
-    puts isochrone.inspect
-    assert_equal Time.parse(&quot;6:26:00&quot;), isochrone[&quot;EMSI&quot;]
-    assert_equal Time.parse(&quot;6:07:00&quot;), isochrone[&quot;NANAA&quot;], &quot;should not be able to get to departure stop before we left&quot;
+    assert_equal Time.parse(&quot;6:26:00&quot;), isochrone[m.stop(&quot;EMSI&quot;)]
+    assert_equal Time.parse(&quot;6:07:00&quot;), isochrone[nanaa], &quot;should not be able to get to departure stop before we left&quot;
+    #puts isochrone.collect {|key,val| [key.stop_id, val]}.sort_by(&amp;:last).inspect
   end
 end
 
@@ -76,15 +77,20 @@ end
 
 class HopTest &lt; Test::Unit::TestCase
   def test_initialize
+    m = MapperFactory.new('sample-feed').mapper(Date.new(2008, 11, 16)) # Sunday
+    beatty     = m.stop(&quot;BEATTY_AIRPORT&quot;)
+    stagecoach = m.stop(&quot;STAGECOACH&quot;)
+    
+    # Making our own stop_times so we can ensure arrival and departure times are sane
     from = StopTime.new :stop_sequence =&gt; 1, :arrival_time =&gt; &quot;6:00:00&quot;, :departure_time =&gt; &quot;6:01:00&quot;,
-                        :stop_id =&gt; &quot;STAGECOACH&quot;, :trip_id =&gt; &quot;STBA&quot;
+                        :stop_id =&gt; stagecoach.stop_id, :trip_id =&gt; &quot;STBA&quot;, :stop =&gt; stagecoach
     to   = StopTime.new :stop_sequence =&gt; 2, :arrival_time =&gt; &quot;6:20:00&quot;, :departure_time =&gt; &quot;6:21:00&quot;,
-                        :stop_id =&gt; &quot;BEATTY_AIRPORT&quot;, :trip_id =&gt; &quot;STBA&quot;
+                        :stop_id =&gt; beatty.stop_id, :trip_id =&gt; &quot;STBA&quot;, :stop =&gt; beatty
     hop = Hop.new(from,to)
     assert_equal &quot;6:01:00&quot;,        hop.departure_time
     assert_equal &quot;6:20:00&quot;,        hop.arrival_time
     assert_equal &quot;STBA&quot;,           hop.trip_id
-    assert_equal &quot;BEATTY_AIRPORT&quot;, hop.destination
+    assert_equal beatty,           hop.destination
   end
 end
 </diff>
      <filename>mapper_test.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>f44f95837ab6ddeb7fc541f3a183407ac3ca7322</id>
    </parent>
  </parents>
  <author>
    <name>Daniel Haran</name>
    <email>chebuctonian@mgmail.com</email>
  </author>
  <url>http://github.com/danielharan/isochrones/commit/fe6ab5b5ca4b36673d69472638974d80cb3b912c</url>
  <id>fe6ab5b5ca4b36673d69472638974d80cb3b912c</id>
  <committed-date>2008-11-18T10:11:52-08:00</committed-date>
  <authored-date>2008-11-18T10:11:52-08:00</authored-date>
  <message>use stops as keys in best_times hash</message>
  <tree>e6e6eae781b7210b00e62e4024fffd07fa6ad507</tree>
  <committer>
    <name>Daniel Haran</name>
    <email>chebuctonian@mgmail.com</email>
  </committer>
</commit>
