added algorithm for finding route length. etc