Getting closer.  Algorithm runs loop twice before choking.  Can't figure out why twice...