add calcRoute function