[routino] 01/11: Imported Upstream version 3.1

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Sun Mar 6 14:19:50 UTC 2016


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository routino.

commit 7683ba34aec70d1f357e6b14c4a903dfdef1199d
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Sun Mar 6 14:03:56 2016 +0100

    Imported Upstream version 3.1
---
 ChangeLog                                       |  370 +++++++
 Makefile.conf                                   |   24 +-
 doc/INSTALL.txt                                 |   14 +-
 doc/LIBRARY.txt                                 |   16 +-
 doc/NEWS.txt                                    |   43 +
 doc/README.txt                                  |    5 +-
 doc/html/installation.html                      |    9 +-
 doc/html/library.html                           |   91 +-
 doc/html/readme.html                            |   69 +-
 extras/find-fixme/Makefile                      |   16 +-
 extras/find-fixme/web/www/.htaccess             |   32 +
 extras/find-fixme/web/www/fixme.html            |    4 +-
 extras/{tagmodifier => statistics}/Makefile     |   49 +-
 extras/statistics/README.txt                    |   22 +
 extras/statistics/create-basemap.pl             |   93 ++
 extras/statistics/create-image.pl               |  270 +++++
 extras/statistics/dumper.c                      |  503 +++++++++
 extras/statistics/update.sh                     |   94 ++
 extras/tagmodifier/Makefile                     |   10 +-
 src/Makefile                                    |   80 +-
 src/optimiser.c                                 | 1278 ++++++++++++++---------
 src/output.c                                    |   71 +-
 src/profiles.c                                  |   11 +-
 src/results.h                                   |    7 +-
 src/router+lib.c                                |   73 +-
 src/router.c                                    |  280 ++---
 src/routino.c                                   |   64 +-
 src/routino.h                                   |   10 +-
 src/segments.h                                  |    4 +-
 src/test/Makefile                               |    7 +-
 src/test/expected/coincident-waypoint-WP01.txt  |    8 +-
 src/test/expected/coincident-waypoint-WP02.txt  |    8 +-
 src/test/expected/coincident-waypoint-WP03.txt  |    8 +-
 src/test/expected/coincident-waypoint-WP04.txt  |    8 +-
 src/test/expected/cycle-both-ways-WP01.txt      |    4 +-
 src/test/expected/cycle-both-ways-WP02.txt      |    4 +-
 src/test/expected/dead-ends-WP01.txt            |    6 +-
 src/test/expected/dead-ends-WP02.txt            |    6 +-
 src/test/expected/dead-ends-WP03.txt            |    6 +-
 src/test/expected/dead-ends-WP04.txt            |    6 +-
 src/test/expected/dead-ends-WP05.txt            |    6 +-
 src/test/expected/dead-ends-WP06.txt            |    6 +-
 src/test/expected/dead-ends-WP07.txt            |    6 +-
 src/test/expected/dead-ends-WP08.txt            |    6 +-
 src/test/expected/dead-ends-WP09.txt            |    6 +-
 src/test/expected/dead-ends-WP10.txt            |    6 +-
 src/test/expected/dead-ends-WP11.txt            |    6 +-
 src/test/expected/fake-node-with-loop-WP01.txt  |    6 +-
 src/test/expected/fake-node-with-loop-WP02.txt  |    6 +-
 src/test/expected/loop-and-reverse-WP-L.txt     |   14 +
 src/test/expected/loop-and-reverse-WP-LR.txt    |   14 +
 src/test/expected/loop-and-reverse-WP-R.txt     |   11 +
 src/test/expected/loop-and-reverse-WP.txt       |   11 +
 src/test/expected/loops-WP01.txt                |    6 +-
 src/test/expected/loops-WP02.txt                |    6 +-
 src/test/expected/loops-WP03.txt                |    6 +-
 src/test/expected/loops-WP04.txt                |    6 +-
 src/test/expected/loops-WP05.txt                |    6 +-
 src/test/expected/loops-WP06.txt                |    6 +-
 src/test/expected/loops-WP07.txt                |    6 +-
 src/test/expected/loops-WP08.txt                |    6 +-
 src/test/expected/loops-WP09.txt                |    6 +-
 src/test/expected/loops-WP10.txt                |    6 +-
 src/test/expected/loops-WP11.txt                |    6 +-
 src/test/expected/no-super-WP01.txt             |    6 +-
 src/test/expected/no-super-WP02.txt             |    6 +-
 src/test/expected/no-super-WP03.txt             |    6 +-
 src/test/expected/no-super-WP04.txt             |    6 +-
 src/test/expected/node-restrictions-WP01.txt    |    6 +-
 src/test/expected/node-restrictions-WP02.txt    |    6 +-
 src/test/expected/node-restrictions-WP03.txt    |    6 +-
 src/test/expected/node-restrictions-WP04.txt    |    6 +-
 src/test/expected/node-restrictions-WP05.txt    |    6 +-
 src/test/expected/node-restrictions-WP06.txt    |    6 +-
 src/test/expected/node-restrictions-WP07.txt    |    6 +-
 src/test/expected/node-restrictions-WP08.txt    |    6 +-
 src/test/expected/oneway-loop-WP01.txt          |    6 +-
 src/test/expected/roundabout-waypoints-WP01.txt |    6 +-
 src/test/expected/roundabout-waypoints-WP02.txt |    6 +-
 src/test/expected/roundabout-waypoints-WP03.txt |    6 +-
 src/test/expected/roundabout-waypoints-WP04.txt |    6 +-
 src/test/expected/roundabout-waypoints-WP05.txt |    6 +-
 src/test/expected/roundabout-waypoints-WP06.txt |    6 +-
 src/test/expected/roundabout-waypoints-WP07.txt |    6 +-
 src/test/expected/super-or-not-WP01.txt         |   14 +-
 src/test/expected/super-or-not-WP02.txt         |    8 +-
 src/test/expected/super-or-not-WP03.txt         |    8 +-
 src/test/expected/super-or-not-WP04.txt         |   13 +
 src/test/expected/super-or-not-WP05.txt         |   13 +
 src/test/expected/turns-WP01.txt                |    6 +-
 src/test/expected/turns-WP02.txt                |    6 +-
 src/test/expected/turns-WP03.txt                |    6 +-
 src/test/expected/turns-WP04.txt                |    6 +-
 src/test/expected/turns-WP05.txt                |    6 +-
 src/test/expected/turns-WP06.txt                |    6 +-
 src/test/expected/turns-WP07.txt                |    6 +-
 src/test/expected/turns-WP08.txt                |    6 +-
 src/test/expected/turns-WP09.txt                |    6 +-
 src/test/expected/turns-WP10.txt                |    6 +-
 src/test/expected/turns-WP11.txt                |    6 +-
 src/test/expected/turns-WP12.txt                |    6 +-
 src/test/expected/turns-WP13.txt                |    6 +-
 src/test/expected/turns-WP14.txt                |    6 +-
 src/test/expected/turns-WP15.txt                |    6 +-
 src/test/expected/turns-WP16.txt                |    6 +-
 src/test/loop-and-reverse.osm                   |   92 ++
 src/test/loop-and-reverse.sh                    |  127 +++
 src/test/super-or-not.osm                       |   88 +-
 src/translations.c                              |   21 +-
 src/translations.h                              |    4 +-
 src/typesx.h                                    |    6 +-
 src/version.h                                   |    2 +-
 src/ways.h                                      |   16 +-
 src/xml/Makefile                                |   12 +-
 src/xmlparse.c                                  |    9 +-
 web/Makefile                                    |    6 +-
 web/translations/router.html                    |   12 +-
 web/translations/translation.de.txt             |   30 +-
 web/translations/translation.en.txt             |    4 +-
 web/translations/translation.fr.txt             |   78 +-
 web/translations/translation.hu.txt             |    1 -
 web/translations/translation.nl.txt             |    5 -
 web/translations/translation.pl.txt             |    5 -
 web/translations/translation.ru.txt             |    5 -
 web/translations/translations-body.xml          |    4 +-
 web/www/routino/.htaccess                       |   25 +-
 web/www/routino/icons/waypoint-loop.png         |  Bin 0 -> 178 bytes
 web/www/routino/icons/waypoint-reverse.png      |  Bin 0 -> 185 bytes
 web/www/routino/profiles.js                     |    2 +-
 web/www/routino/profiles.pl                     |    2 +-
 web/www/routino/router.css                      |   24 +
 web/www/routino/router.html.de                  |   18 +-
 web/www/routino/router.html.en                  |   14 +-
 web/www/routino/router.html.fr                  |   76 +-
 web/www/routino/router.html.hu                  |   14 +-
 web/www/routino/router.html.nl                  |   14 +-
 web/www/routino/router.html.pl                  |   14 +-
 web/www/routino/router.html.ru                  |   14 +-
 web/www/routino/router.leaflet.js               |   77 +-
 web/www/routino/router.openlayers.js            |   75 +-
 web/www/routino/router.pl                       |    8 +-
 web/www/routino/visualiser.html.de              |   44 +-
 web/www/routino/visualiser.html.en              |    2 +-
 web/www/routino/visualiser.html.fr              |   34 +-
 web/www/routino/visualiser.html.hu              |    2 +-
 web/www/routino/visualiser.html.nl              |    2 +-
 web/www/routino/visualiser.html.pl              |    2 +-
 web/www/routino/visualiser.html.ru              |    2 +-
 xml/routino-profiles.xml                        |   14 +-
 xml/routino-translations.xml                    |   52 +-
 150 files changed, 3777 insertions(+), 1406 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 8d78060..f1865f5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,373 @@
+2016-03-05  Andrew M. Bishop <amb>
+
+	Version 3.0 released.
+
+2016-03-05 [r1866]  Andrew M. Bishop <amb>
+
+	* FILES, doc/NEWS.txt, doc/README.txt, doc/html/readme.html: Update
+	  for version 3.1 release.
+
+2016-02-28 [r1865]  Andrew M. Bishop <amb>
+
+	* src/typesx.h: Change node_t to a 64-bit type by default due to
+	  the imminent OSM node number overflow with 32-bits.
+
+2016-02-28 [r1865]  Andrew M. Bishop <amb>
+
+	* src/typesx.h: Change node_t to a 64-bit type by default due to
+	  the imminent OSM node number overflow with 32-bits.
+
+2016-02-27 [r1864]  Andrew M. Bishop <amb>
+
+	* src/xmlparse.c: Fix an XML parsing bug found by AFL.
+
+2016-02-25 [r1863]  Andrew M. Bishop <amb>
+
+	* Makefile.conf, src/segments.h, src/ways.h: Fix some changes found
+	  with gcc sanitizer options.
+
+2016-02-24 [r1857]  Andrew M. Bishop <amb>
+
+	* src/optimiser.c: Change the FindMiddleRoute function so that it
+	  routes from both ends towards the middle. This will make it much
+	  quicker to detect some cases where a route is impossible but it
+	  does slightly slow down normal operation.
+
+2016-02-14 [r1856]  Andrew M. Bishop <amb>
+
+	* extras/statistics (added), extras/statistics/Makefile (added),
+	  extras/statistics/README.txt (added),
+	  extras/statistics/create-basemap.pl (added),
+	  extras/statistics/create-image.pl (added),
+	  extras/statistics/dumper.c (added), extras/statistics/update.sh
+	  (added): Add scripts that will process the Routino database and
+	  generate maps with highway statistics.
+
+2016-02-12 [r1855]  Andrew M. Bishop <amb>
+
+	* extras/find-fixme/Makefile: Use '$(DEPDIR)' rather than '.deps'.
+
+2016-01-05 [r1854]  Andrew M. Bishop <amb>
+
+	* src/profiles.c: Remove a couple of lines of code with a literal
+	  type conversion error. Add special checks that neither max_pref
+	  or max_speed are zero.
+
+2015-12-30 [r1852-1853]  Andrew M. Bishop <amb>
+
+	* doc/INSTALL.txt, doc/html/installation.html,
+	  extras/find-fixme/web/www/.htaccess (added),
+	  web/www/routino/.htaccess: Update the instructions about setting
+	  up Apache (tested on Apache 2.4.x).
+
+	* web/translations/translation.de.txt,
+	  xml/routino-translations.xml: More German translations (via
+	  http://www.routino.org/translations/).
+
+2015-12-24 [r1851]  Andrew M. Bishop <amb>
+
+	* src/optimiser.c: Remove a lookup in the FixForwardRoute function.
+
+2015-12-21 [r1850]  Andrew M. Bishop <amb>
+
+	* xml/routino-profiles.xml: Reduce the preference for service roads
+	  when driving.
+
+2015-12-21 [r1849]  Andrew M. Bishop <amb>
+
+	* src/optimiser.c: Add an experimental (commented out) version of
+	  the FindMiddleRoute function that finds the route in reverse
+	  (starting at the end working back to the beginning). Verified to
+	  give equivalent, if not identical, results to the existing
+	  function.
+
+2015-12-21 [r1848]  Andrew M. Bishop <amb>
+
+	* src/optimiser.c: Simplify the way that the beginning of the route
+	  is inserted into the results.
+
+2015-12-18 [r1847]  Andrew M. Bishop <amb>
+
+	* src/optimiser.c, src/results.h: Change the way that the beginning
+	  of the route is used to seed the search for the super-route and
+	  then to create the combined route.
+
+2015-12-18 [r1846]  Andrew M. Bishop <amb>
+
+	* src/optimiser.c, src/test/expected/super-or-not-WP01.txt,
+	  src/test/expected/super-or-not-WP02.txt,
+	  src/test/expected/super-or-not-WP03.txt,
+	  src/test/expected/super-or-not-WP04.txt (added),
+	  src/test/expected/super-or-not-WP05.txt (added),
+	  src/test/super-or-not.osm: Fix a bug where the optimum end of the
+	  route was not being used because the search was stopping at the
+	  first super-node that was part of another possible end of the
+	  route. Add to an existing test case.
+
+2015-12-15 [r1845]  Andrew M. Bishop <amb>
+
+	* src/optimiser.c: Improve the debug output (add debugging
+	  information to the FindSuperSegment function).
+
+2015-12-14 [r1844]  Andrew M. Bishop <amb>
+
+	* src/optimiser.c: Improve the debug output (use a common function
+	  for all of them and add more information).
+
+2015-12-08 [r1843]  Andrew M. Bishop <amb>
+
+	* src/optimiser.c: Rewrite FindFinishRoutes so that it does not
+	  find node-segment pairs pointing in reverse and then reverse them
+	  but find normal node-segment pairs working backwards.
+
+2015-12-07 [r1842]  Andrew M. Bishop <amb>
+
+	* src/optimiser.c: Fix bug in last change (FindFinishRoutes is not
+	  the same as the other functions).
+
+2015-12-05 [r1835]  Andrew M. Bishop <amb>
+
+	* src/optimiser.c: Rename some variables, move some lines of code
+	  around and extract some code into a separate function. Tidying
+	  up, no functional change.
+
+2015-12-01 [r1834]  Andrew M. Bishop <amb>
+
+	* web/translations/translation.de.txt: More German translations
+	  (via http://www.routino.org/translations/).
+
+2015-11-24 [r1833]  Andrew M. Bishop <amb>
+
+	* extras/find-fixme/web/www/fixme.html: Fix error in non-Javascript
+	  version of statistics URL.
+
+2015-10-24 [r1832]  Andrew M. Bishop <amb>
+
+	* src/router.c: Fix routing bug where missing waypoint data still
+	  gets routed.
+
+2015-10-24 [r1831]  Andrew M. Bishop <amb>
+
+	* web/www/routino/router.leaflet.js,
+	  web/www/routino/router.openlayers.js: Store the home location
+	  cookie with 5 decimal places. Fix the home marker icon jumping
+	  about (Leaflet version).
+
+2015-10-24 [r1830]  Andrew M. Bishop <amb>
+
+	* web/www/routino/router.leaflet.js,
+	  web/www/routino/router.openlayers.js: Print an error message if
+	  the geolocation function fails or is unavailable.
+
+2015-10-17 [r1828]  Andrew M. Bishop <amb>
+
+	* src/routino.c, src/test/loop-and-reverse.sh: Fix test case for
+	  loop and reverse and fix libroutino error that wasn't detected by
+	  broken test case.
+
+2015-10-12 [r1826-1827]  Andrew M. Bishop <amb>
+
+	* src/test, src/test/expected/loop-and-reverse-WP-L.txt (added),
+	  src/test/expected/loop-and-reverse-WP-LR.txt (added),
+	  src/test/expected/loop-and-reverse-WP-R.txt (added),
+	  src/test/expected/loop-and-reverse-WP.txt (added),
+	  src/test/loop-and-reverse.osm (added),
+	  src/test/loop-and-reverse.sh (added): Add a test case for the
+	  loop and reverse route options.
+
+	* doc/LIBRARY.txt, doc/html/library.html, src/router+lib.c,
+	  src/routino.c, src/routino.h: Add the loop and reverse route
+	  options to the library. Increased the API version number.
+
+2015-10-07 [r1824-1825]  Andrew M. Bishop <amb>
+
+	* src/router+lib.c: Fix a bug with the change to handle reverse and
+	  loop together.
+
+	* src/router.c: Simplify the ugly code for handling reverse and
+	  loop better - more code, simpler to understand. Calculate all the
+	  waypoints first and then use the points.
+
+2015-09-30 [r1823]  Andrew M. Bishop <amb>
+
+	* src/router+lib.c, src/router.c: When using --reverse and --loop
+	  together start at the first waypoint specified rather than the
+	  last one specified.
+
+2015-09-30 [r1822]  Andrew M. Bishop <amb>
+
+	* web/Makefile: Force the make not to be run in parallel in the web
+	  directory.
+
+2015-09-30 [r1821]  Andrew M. Bishop <amb>
+
+	* web/translations/translation.fr.txt,
+	  xml/routino-translations.xml: Add new and updated French
+	  translations (via http://www.routino.org/translations/).
+
+2015-09-29 [r1820]  Andrew M. Bishop <amb>
+
+	* extras/find-fixme/Makefile, extras/tagmodifier/Makefile,
+	  src/xml/Makefile: Re-implement the change to allow using 'make -j
+	  4'.
+
+2015-09-29 [r1819]  Andrew M. Bishop <amb>
+
+	* src/Makefile, web/Makefile: Re-implement the change to allow
+	  using 'make -j 4'.
+
+2015-09-28 [r1818]  Andrew M. Bishop <amb>
+
+	* doc/LIBRARY.txt, doc/html/library.html, src/router+lib.c,
+	  src/routino.c, src/routino.h: Include the version number of
+	  Routino that was used to compile the library into the library as
+	  a string variable.
+
+2015-09-28 [r1817]  Andrew M. Bishop <amb>
+
+	* src/router+lib.c, src/router.c: Make router.c and router+lib.c
+	  more similar without changing the functionality.
+
+2015-09-26 [r1815-1816]  Andrew M. Bishop <amb>
+
+	* src/test/expected/coincident-waypoint-WP01.txt,
+	  src/test/expected/coincident-waypoint-WP02.txt,
+	  src/test/expected/coincident-waypoint-WP03.txt,
+	  src/test/expected/coincident-waypoint-WP04.txt,
+	  src/test/expected/cycle-both-ways-WP01.txt,
+	  src/test/expected/cycle-both-ways-WP02.txt,
+	  src/test/expected/dead-ends-WP01.txt,
+	  src/test/expected/dead-ends-WP02.txt,
+	  src/test/expected/dead-ends-WP03.txt,
+	  src/test/expected/dead-ends-WP04.txt,
+	  src/test/expected/dead-ends-WP05.txt,
+	  src/test/expected/dead-ends-WP06.txt,
+	  src/test/expected/dead-ends-WP07.txt,
+	  src/test/expected/dead-ends-WP08.txt,
+	  src/test/expected/dead-ends-WP09.txt,
+	  src/test/expected/dead-ends-WP10.txt,
+	  src/test/expected/dead-ends-WP11.txt,
+	  src/test/expected/fake-node-with-loop-WP01.txt,
+	  src/test/expected/fake-node-with-loop-WP02.txt,
+	  src/test/expected/loops-WP01.txt,
+	  src/test/expected/loops-WP02.txt,
+	  src/test/expected/loops-WP03.txt,
+	  src/test/expected/loops-WP04.txt,
+	  src/test/expected/loops-WP05.txt,
+	  src/test/expected/loops-WP06.txt,
+	  src/test/expected/loops-WP07.txt,
+	  src/test/expected/loops-WP08.txt,
+	  src/test/expected/loops-WP09.txt,
+	  src/test/expected/loops-WP10.txt,
+	  src/test/expected/loops-WP11.txt,
+	  src/test/expected/no-super-WP01.txt,
+	  src/test/expected/no-super-WP02.txt,
+	  src/test/expected/no-super-WP03.txt,
+	  src/test/expected/no-super-WP04.txt,
+	  src/test/expected/node-restrictions-WP01.txt,
+	  src/test/expected/node-restrictions-WP02.txt,
+	  src/test/expected/node-restrictions-WP03.txt,
+	  src/test/expected/node-restrictions-WP04.txt,
+	  src/test/expected/node-restrictions-WP05.txt,
+	  src/test/expected/node-restrictions-WP06.txt,
+	  src/test/expected/node-restrictions-WP07.txt,
+	  src/test/expected/node-restrictions-WP08.txt,
+	  src/test/expected/oneway-loop-WP01.txt,
+	  src/test/expected/roundabout-waypoints-WP01.txt,
+	  src/test/expected/roundabout-waypoints-WP02.txt,
+	  src/test/expected/roundabout-waypoints-WP03.txt,
+	  src/test/expected/roundabout-waypoints-WP04.txt,
+	  src/test/expected/roundabout-waypoints-WP05.txt,
+	  src/test/expected/roundabout-waypoints-WP06.txt,
+	  src/test/expected/roundabout-waypoints-WP07.txt,
+	  src/test/expected/super-or-not-WP01.txt,
+	  src/test/expected/super-or-not-WP02.txt,
+	  src/test/expected/super-or-not-WP03.txt,
+	  src/test/expected/turns-WP01.txt,
+	  src/test/expected/turns-WP02.txt,
+	  src/test/expected/turns-WP03.txt,
+	  src/test/expected/turns-WP04.txt,
+	  src/test/expected/turns-WP05.txt,
+	  src/test/expected/turns-WP06.txt,
+	  src/test/expected/turns-WP07.txt,
+	  src/test/expected/turns-WP08.txt,
+	  src/test/expected/turns-WP09.txt,
+	  src/test/expected/turns-WP10.txt,
+	  src/test/expected/turns-WP11.txt,
+	  src/test/expected/turns-WP12.txt,
+	  src/test/expected/turns-WP13.txt,
+	  src/test/expected/turns-WP14.txt,
+	  src/test/expected/turns-WP15.txt,
+	  src/test/expected/turns-WP16.txt: Change test cases for the
+	  changed output formats.
+
+	* src/output.c, src/translations.c, src/translations.h,
+	  web/translations/translation.de.txt,
+	  web/translations/translation.en.txt,
+	  web/translations/translation.fr.txt,
+	  web/translations/translation.hu.txt,
+	  web/translations/translation.nl.txt,
+	  web/translations/translation.pl.txt,
+	  web/translations/translation.ru.txt,
+	  web/translations/translations-body.xml,
+	  xml/routino-translations.xml: Change file output formats so that
+	  waypoint numbers are included. Change the names of the GPX route
+	  waypoints in the XML file.
+
+2015-09-26 [r1814]  Andrew M. Bishop <amb>
+
+	* src/Makefile, src/test/Makefile: Fix makefiles so that 'make
+	  test' works from a clean directory.
+
+2015-09-26 [r1813]  Andrew M. Bishop <amb>
+
+	* src/router+lib.c, src/router.c, web/translations/router.html,
+	  web/www/routino/icons/waypoint-loop.png (added),
+	  web/www/routino/icons/waypoint-reverse.png (added),
+	  web/www/routino/router.css, web/www/routino/router.leaflet.js,
+	  web/www/routino/router.openlayers.js, web/www/routino/router.pl:
+	  Add a loop and reverse checkbox on the web page and replace the
+	  loop and reverse buttons with icons. Update router programs and
+	  scripts.
+
+2015-09-26 [r1812]  Andrew M. Bishop <amb>
+
+	* web/www/routino/router.leaflet.js,
+	  web/www/routino/router.openlayers.js: Fix bug with specifying
+	  'oneway' or 'turns' in the URL arguments.
+
+2015-09-24 [r1810]  Andrew M. Bishop <amb>
+
+	* src/router+lib.c: Fix a bug with freeing the waypoints if routing
+	  a loop.
+
+2015-09-15 [r1804]  Andrew M. Bishop <amb>
+
+	* extras/find-fixme/Makefile, extras/tagmodifier/Makefile,
+	  src/Makefile, src/xml/Makefile, web/Makefile: Fix Makefiles so
+	  that 'make -j 4' works.
+
+2015-09-15 [r1803]  Andrew M. Bishop <amb>
+
+	* Makefile.conf, src/Makefile: Add a "SONAME" shared library
+	  version number.
+
+2015-09-15 [r1801-1802]  Andrew M. Bishop <amb>
+
+	* src/version.h: Change the version number so that anybody using
+	  the SVN version knows that it is not the released version and let
+	  them take care about the exact version.
+
+	* src/Makefile: Don't create the *.so files on Windows.
+
+2015-09-14 [r1799-1800]  Andrew M. Bishop <amb>
+
+	* web/www/routino/router.leaflet.js,
+	  web/www/routino/router.openlayers.js: Make the whole row of the
+	  route clickable, not just the number on the left.
+
+	* doc/html/library.html: Give each HTML header a unique id.
+
 2015-09-12  Andrew M. Bishop <amb>
 
 	Version 3.0 released.
diff --git a/Makefile.conf b/Makefile.conf
index cc112e0..a1cfb24 100644
--- a/Makefile.conf
+++ b/Makefile.conf
@@ -61,11 +61,21 @@ datadir=$(prefix)/xml
 endif
 
 
+# Library version for ABI compatibility
+SOVERSION=0
+
+# Full library version (SOVERSION.MINOR[.RELEASE])
+LIBVERSION=$(SOVERSION).0.0
+
+
 # Compilation programs
 CC=gcc
 LD=gcc
 
 
+# Maths library
+LDFLAGS=-lm
+
 # Language dialect selection
 CFLAGS=-std=c99
 
@@ -82,9 +92,13 @@ CFLAGS+=-ffast-math
 # Debugging symbols
 #CFLAGS+=-g
 
+# Sanitizer for debugging memory addresses
+#CFLAGS+=-fsanitize=address -fsanitize=leak
+#LDFLAGS+=-fsanitize=address -fsanitize=leak
 
-# Maths library
-LDFLAGS=-lm
+# Sanitizer for debugging undefined behaviour
+#CFLAGS+=-fsanitize=undefined
+#LDFLAGS+=-fsanitize=undefined
 
 
 # Extra flags for compiling libroutino shared library (visibility of symbols, shared)
@@ -97,6 +111,12 @@ CFLAGS_LIB+=-fPIC
 LDFLAGS_LIB+=-fPIC
 endif
 
+ifeq ($(HOST),UNIX)
+# Extra flags for compiling libroutino shared library (SONAME)
+LDFLAGS_SONAME=-Wl,-soname=libroutino.so.$(SOVERSION)
+LDFLAGS_SLIM_SONAME=-Wl,-soname=libroutino-slim.so.$(SOVERSION)
+endif
+
 # Put the current directory in the shared library path for the router using libroutino
 LDFLAGS_LDSO=-Wl,-R.
 
diff --git a/doc/INSTALL.txt b/doc/INSTALL.txt
index 0ee8b48..c65ff76 100644
--- a/doc/INSTALL.txt
+++ b/doc/INSTALL.txt
@@ -287,20 +287,18 @@ Configuration of web files
 Configuration of Web Server
 ---------------------------
 
-   The file 'www/routino/.htaccess' contains all of the Apache
-   configuration options that are required to get the example web pages
-   running. The only problem is that because of the way that the
-   "AllowOverride" option works one of the configuration options has been
-   commented out. This must be enabled in the main Apache server
-   configuration file.
+   The file 'www/routino/.htaccess' contains all of the Apache configuration
+   options that are required to get the example web pages running. The
+   only problem is that some of the configuration options in that file
+   will not work unless they are allowed by the 'AllowOverride' option in
+   the main Apache server configuration file.
 
    If you have copied the routino 'web' directory into '/var/www' and named
    it 'routino' then the entry that you need in your Apache configuration
    file is this one:
   
      <Directory /var/www/routino>
-         AllowOverride All
-         Options +ExecCGI
+         AllowOverride Options=MultiViews,ExecCGI FileInfo Limit
      </Directory>
 
    This can be placed anywhere between the <VirtualHost *:80> and
diff --git a/doc/LIBRARY.txt b/doc/LIBRARY.txt
index fa5bb8e..f9fde88 100644
--- a/doc/LIBRARY.txt
+++ b/doc/LIBRARY.txt
@@ -92,7 +92,7 @@ Preprocessor Definitions
 - - - - - - - - - - - -
 
    A version number for the Routino API.
-   #define ROUTINO_API_VERSION 7
+   #define ROUTINO_API_VERSION 8
 
 Error Definitions
 
@@ -204,6 +204,12 @@ Routino Option Definitions
    information.
    #define ROUTINO_ROUTE_LIST_TEXT_ALL 1024
 
+   Route between the points in a loop returning to the first point.
+   #define ROUTINO_ROUTE_LOOP 2048
+
+   Route between the points in reverse order.
+   #define ROUTINO_ROUTE_REVERSE 4096
+
 Linked List Output Point Definitions
 
    An unimportant, intermediate, node.
@@ -408,7 +414,13 @@ Global Variable Routino_APIVersion
 
    Contains the libroutino API version number.
 
-   int Routino_APIVersion
+   const int Routino_APIVersion
+
+Global Variable Routino_Version
+
+   Contains the Routino version number.
+
+   const char* Routino_Version
 
 Global Variable Routino_errno
 
diff --git a/doc/NEWS.txt b/doc/NEWS.txt
index 756fe85..d618d9e 100644
--- a/doc/NEWS.txt
+++ b/doc/NEWS.txt
@@ -1,3 +1,46 @@
+Version 3.1 of Routino released : Sat Mar 5 2016
+------------------------------------------------
+
+Bug fixes:
+  Make the whole of the highlighted entry on the webpage clickable.
+  Fix Makefiles so that 'make -j 4' works.
+  Fix Makefiles so that 'make test' works from a clean directory.
+  Fix bug on webpage with 'oneway' or 'turns' in the URL arguments.
+  Print error message on webpage if geolocation function unavailable.
+  Fix bug where the optimum end of the route was not being found.
+  Reduce the preference for service roads in the default routing profile.
+  Remove literal type conversion error when validating profile values.
+
+Library:
+  Add a version number to the shared library (SONAME).
+  Include the version number of Routino into the library as a string variable.
+  Add loop and reverse route as options to the library.
+
+planetsplitter:
+  Use 64-bit numbers for the node ID when processing an OSM file.
+
+router:
+  Change file output formats so that waypoint numbers are included.
+  When calculating a route with loop and reverse start route from waypoint 1.
+  Calculate the route from both ends towards the middle.
+
+Translations:
+  Change the names of the GPX route waypoints in translations.xml.
+  Updated French and German translations.
+
+Documentation
+  Updated the instructions for setting up on Apache (version 2.4.x).
+
+Web pages:
+  Add a loop & reverse checkbox, replace loop & reverse buttons with icons.
+
+Extras:
+  Add scripts to process the database and create maps of highway statistics.
+
+
+Note: This version is compatible with databases from versions 2.7.1 - 3.0.
+
+
 Version 3.0 of Routino released : Sat Sep 12 2015
 -------------------------------------------------
 
diff --git a/doc/README.txt b/doc/README.txt
index 993435c..92d7527 100644
--- a/doc/README.txt
+++ b/doc/README.txt
@@ -130,6 +130,7 @@ Status
    Version 2.7.2 of Routino was released on 26th June 2014.
    Version 2.7.3 of Routino was released on 8th November 2014.
    Version 3.0 of Routino was released on 12th September 2015.
+   Version 3.1 of Routino was released on 5th March 2016.
 
    The full version history is available in the NEWS.txt file.
 
@@ -151,7 +152,7 @@ License
 Copyright
 ---------
 
-   Routino is copyright Andrew M. Bishop 2008-2015.
+   Routino is copyright Andrew M. Bishop 2008-2016.
 
 
 Homepage
@@ -186,4 +187,4 @@ Subversion
 
 --------
 
-Copyright 2008-2015 Andrew M. Bishop.
+Copyright 2008-2016 Andrew M. Bishop.
diff --git a/doc/html/installation.html b/doc/html/installation.html
index 1f03175..07ea95f 100644
--- a/doc/html/installation.html
+++ b/doc/html/installation.html
@@ -391,9 +391,9 @@ the Routino documentation.
 
 The file <tt>www/routino/.htaccess</tt> contains all of the Apache configuration
 options that are required to get the example web pages running.  The only
-problem is that because of the way that the <tt>AllowOverride</tt> option works
-one of the configuration options has been commented out.  This must be enabled
-in the main Apache server configuration file.
+problem is that some of the configuration options in that file will not work
+unless they are allowed by the <tt>AllowOverride</tt> option in the main Apache
+server configuration file.
 
 <p>
 
@@ -403,8 +403,7 @@ configuration file is this one:
 
 <pre>
      <Directory /var/www/routino>
-         AllowOverride All
-         Options +ExecCGI
+         AllowOverride Options=MultiViews,ExecCGI FileInfo Limit
      </Directory>
 </pre>
 
diff --git a/doc/html/library.html b/doc/html/library.html
index a849f6c..a5cea2e 100644
--- a/doc/html/library.html
+++ b/doc/html/library.html
@@ -194,14 +194,14 @@ the software is distributed or interacted with over a network.
 
 <h2 id="H_1_3">Routino Library API</h2>
 
-<h3>Preprocessor Definitions</h3>
+<h3 id="H_1_3_1">Preprocessor Definitions</h3>
 
 <p>
 <span class="cxref-define-comment"> A version number for the Routino API. </span>
 <br>
-<span class="cxref-define">#define ROUTINO_API_VERSION 7</span>
+<span class="cxref-define">#define ROUTINO_API_VERSION 8</span>
 
-<h4>Error Definitions</h4>
+<h4 id="H_1_3_1_1">Error Definitions</h4>
 
 <p>
 <span class="cxref-define-comment"> No error. </span>
@@ -292,7 +292,7 @@ the software is distributed or interacted with over a network.
 <br>
 <span class="cxref-define">#define ROUTINO_ERROR_NO_ROUTE_3 1003</span>
 
-<h4>Routino Option Definitions</h4>
+<h4 id="H_1_3_1_2">Routino Option Definitions</h4>
 
 <p>
 <span class="cxref-define-comment"> Calculate the shortest route. </span>
@@ -342,8 +342,16 @@ the software is distributed or interacted with over a network.
 <span class="cxref-define-comment"> Output a linked list of points containing the text all file information. </span>
 <br>
 <span class="cxref-define">#define ROUTINO_ROUTE_LIST_TEXT_ALL 1024</span>
+<p>
+<span class="cxref-define-comment"> Route between the points in a loop returning to the first point. </span>
+<br>
+<span class="cxref-define">#define ROUTINO_ROUTE_LOOP 2048</span>
+<p>
+<span class="cxref-define-comment"> Route between the points in reverse order. </span>
+<br>
+<span class="cxref-define">#define ROUTINO_ROUTE_REVERSE 4096</span>
 
-<h4>Linked List Output Point Definitions</h4>
+<h4 id="H_1_3_1_3">Linked List Output Point Definitions</h4>
 
 <p>
 <span class="cxref-define-comment"> An unimportant, intermediate, node. </span>
@@ -386,7 +394,7 @@ the software is distributed or interacted with over a network.
 <br>
 <span class="cxref-define">#define ROUTINO_POINT_WAYPOINT 9</span>
 
-<h4>Profile Definitions</h4>
+<h4 id="H_1_3_1_4">Profile Definitions</h4>
 
 <p>
 <span class="cxref-define-comment"> A Motorway highway. </span>
@@ -466,37 +474,37 @@ the software is distributed or interacted with over a network.
 <span class="cxref-define">#define ROUTINO_PROPERTY_BICYCLEROUTE 6</span>
 
 
-<h3>Type Definitions</h3>
+<h3 id="H_1_3_2">Type Definitions</h3>
 
-<h4><a name="type-Routino_Database">Typedef Routino_Database</a></h4>
+<h4 id="H_1_3_2_1"><a name="type-Routino_Database">Typedef Routino_Database</a></h4>
 
 <p>
 <span class="cxref-type-comment"> A data structure to hold a Routino database loaded from a file (the contents are private). </span>
 <br>
 <span class="cxref-type">typedef struct _Routino_Database Routino_Database</span>
 
-<h4><a name="type-Routino_Waypoint">Typedef Routino_Waypoint</a></h4>
+<h4 id="H_1_3_2_2"><a name="type-Routino_Waypoint">Typedef Routino_Waypoint</a></h4>
 
 <p>
 <span class="cxref-type-comment"> A data structure to hold a Routino waypoint found within the database (the contents are private). </span>
 <br>
 <span class="cxref-type">typedef struct _Routino_Waypoint Routino_Waypoint</span>
 
-<h4><a name="type-Routino_Profile">Typedef Routino_Profile</a></h4>
+<h4 id="H_1_3_2_3"><a name="type-Routino_Profile">Typedef Routino_Profile</a></h4>
 
 <p>
 <span class="cxref-type-comment"> A data structure to hold a Routino routing profile (the contents are private). </span>
 <br>
 <span class="cxref-type">typedef struct _Routino_Profile Routino_Profile</span>
 
-<h4><a name="type-Routino_Translation">Typedef Routino_Translation</a></h4>
+<h4 id="H_1_3_2_4"><a name="type-Routino_Translation">Typedef Routino_Translation</a></h4>
 
 <p>
 <span class="cxref-type-comment"> A data structure to hold a Routino translation (the contents are private). </span>
 <br>
 <span class="cxref-type">typedef struct _Routino_Translation Routino_Translation</span>
 
-<h4><a name="type-Routino_UserProfile">Typedef Routino_UserProfile</a></h4>
+<h4 id="H_1_3_2_5"><a name="type-Routino_UserProfile">Typedef Routino_UserProfile</a></h4>
 
 <p>
 <span class="cxref-type-comment"> A data structure to hold a routing profile that can be defined by the user. </span>
@@ -568,14 +576,14 @@ the software is distributed or interacted with over a network.
   </tr>
 </table>
 
-<h4><a name="type-Routino_Output">Typedef Routino_Output</a></h4>
+<h4 id="H_1_3_2_6"><a name="type-Routino_Output">Typedef Routino_Output</a></h4>
 
 <p>
 <span class="cxref-type-comment"> Forward declaration of the Routino_Output data type. </span>
 <br>
 <span class="cxref-type">typedef struct _Routino_Output Routino_Output</span>
 
-<h4><a name="type-struct-_Routino_Output">Type struct _Routino_Output</a></h4>
+<h4 id="H_1_3_2_7"><a name="type-struct-_Routino_Output">Type struct _Routino_Output</a></h4>
 
 <p>
 <span class="cxref-type-comment"> A linked list output of the calculated route whose contents depend on the ROUTINO_ROUTE_LIST_* options selected. </span>
@@ -662,23 +670,30 @@ the software is distributed or interacted with over a network.
   </tr>
 </table>
 
-<h4><a name="type-Routino_ProgressFunc">Typedef Routino_ProgressFunc</a></h4>
+<h4 id="H_1_3_2_8"><a name="type-Routino_ProgressFunc">Typedef Routino_ProgressFunc</a></h4>
 
 <p>
 <span class="cxref-type-comment"> A type of function that can be used as a callback to indicate routing progress, if it returns false the router stops. </span>
 <br>
 <span class="cxref-type">typedef int (*Routino_ProgressFunc)(double complete)</span>
 
-<h3>Variable Definitions</h3>
+<h3 id="H_1_3_3">Variable Definitions</h3>
 
-<h4><a name="var-Routino_APIVersion">Global Variable Routino_APIVersion</a></h4>
+<h4 id="H_1_3_3_1"><a name="var-Routino_APIVersion">Global Variable Routino_APIVersion</a></h4>
 
 <p>
 <span class="cxref-variable-comment"> Contains the libroutino API version number. </span>
 <br>
-<span class="cxref-variable">int Routino_APIVersion</span>
+<span class="cxref-variable">const int Routino_APIVersion</span>
+
+<h4 id="H_1_3_3_2"><a name="var-Routino_Version">Global Variable Routino_Version</a></h4>
+
+<p>
+<span class="cxref-variable-comment"> Contains the Routino version number. </span>
+<br>
+<span class="cxref-variable">const char* Routino_Version</span>
 
-<h4><a name="var-Routino_errno">Global Variable Routino_errno</a></h4>
+<h4 id="H_1_3_3_3"><a name="var-Routino_errno">Global Variable Routino_errno</a></h4>
 
 <p>
 <span class="cxref-variable-comment"> Contains the error number of the most recent Routino function (one of the ROUTINO_ERROR_* values). </span>
@@ -686,9 +701,9 @@ the software is distributed or interacted with over a network.
 <span class="cxref-variable">int Routino_errno</span>
 
 
-<h3>Function Definitions</h3>
+<h3 id="H_1_3_4">Function Definitions</h3>
 
-<h4><a name="func-Routino_CalculateRoute">Global Function Routino_CalculateRoute()</a></h4>
+<h4 id="H_1_3_4_1"><a name="func-Routino_CalculateRoute">Global Function Routino_CalculateRoute()</a></h4>
 
 <p>
 <span class="cxref-function-comment">  Calculate a route using a loaded database, chosen profile, chosen translation and set of waypoints.</span>
@@ -714,7 +729,7 @@ the software is distributed or interacted with over a network.
   <dd><span class="cxref-function-comment">A function to be called occasionally to report progress or NULL.</span>
 </dl>
 
-<h4><a name="func-Routino_Check_API_Version">Global Function Routino_Check_API_Version()</a></h4>
+<h4 id="H_1_3_4_2"><a name="func-Routino_Check_API_Version">Global Function Routino_Check_API_Version()</a></h4>
 
 <p>
 <span class="cxref-function-comment">  Check the version of the library used by the caller against the library version</span>
@@ -735,7 +750,7 @@ the software is distributed or interacted with over a network.
 <br>
 <span class="cxref-define">#define Routino_CheckAPIVersion()</span>
 
-<h4><a name="func-Routino_CreateProfileFromUserProfile">Global Function Routino_CreateProfileFromUserProfile()</a></h4>
+<h4 id="H_1_3_4_3"><a name="func-Routino_CreateProfileFromUserProfile">Global Function Routino_CreateProfileFromUserProfile()</a></h4>
 
 <p>
 <span class="cxref-function-comment">  Create a fully formed Routino Profile from a Routino User Profile.</span>
@@ -749,7 +764,7 @@ the software is distributed or interacted with over a network.
   <dd><span class="cxref-function-comment">The user specified profile to convert (not modified by this).</span>
 </dl>
 
-<h4><a name="func-Routino_CreateUserProfileFromProfile">Global Function Routino_CreateUserProfileFromProfile()</a></h4>
+<h4 id="H_1_3_4_4"><a name="func-Routino_CreateUserProfileFromProfile">Global Function Routino_CreateUserProfileFromProfile()</a></h4>
 
 <p>
 <span class="cxref-function-comment">  Create a Routino User Profile from a Routino Profile loaded from an XML file.</span>
@@ -763,7 +778,7 @@ the software is distributed or interacted with over a network.
   <dd><span class="cxref-function-comment">The Routino Profile to convert (not modified by this).</span>
 </dl>
 
-<h4><a name="func-Routino_DeleteRoute">Global Function Routino_DeleteRoute()</a></h4>
+<h4 id="H_1_3_4_5"><a name="func-Routino_DeleteRoute">Global Function Routino_DeleteRoute()</a></h4>
 
 <p>
 <span class="cxref-function-comment">  Delete the linked list created by Routino_CalculateRoute.</span>
@@ -775,7 +790,7 @@ the software is distributed or interacted with over a network.
   <dd><span class="cxref-function-comment">The output to be deleted.</span>
 </dl>
 
-<h4><a name="func-Routino_FindWaypoint">Global Function Routino_FindWaypoint()</a></h4>
+<h4 id="H_1_3_4_6"><a name="func-Routino_FindWaypoint">Global Function Routino_FindWaypoint()</a></h4>
 
 <p>
 <span class="cxref-function-comment">  Finds the nearest point in the database to the specified latitude and longitude.</span>
@@ -795,21 +810,21 @@ the software is distributed or interacted with over a network.
   <dd><span class="cxref-function-comment">The longitude in degrees of the point.</span>
 </dl>
 
-<h4><a name="func-Routino_FreeXMLProfiles">Global Function Routino_FreeXMLProfiles()</a></h4>
+<h4 id="H_1_3_4_7"><a name="func-Routino_FreeXMLProfiles">Global Function Routino_FreeXMLProfiles()</a></h4>
 
 <p>
 <span class="cxref-function-comment">  Free the internal memory that was allocated for the Routino profiles loaded from the XML file.</span>
 <br>
 <span class="cxref-function">void Routino_FreeXMLProfiles ( void )</span>
 
-<h4><a name="func-Routino_FreeXMLTranslations">Global Function Routino_FreeXMLTranslations()</a></h4>
+<h4 id="H_1_3_4_8"><a name="func-Routino_FreeXMLTranslations">Global Function Routino_FreeXMLTranslations()</a></h4>
 
 <p>
 <span class="cxref-function-comment">  Free the internal memory that was allocated for the Routino translations loaded from the XML file.</span>
 <br>
 <span class="cxref-function">void Routino_FreeXMLTranslations ( void )</span>
 
-<h4><a name="func-Routino_GetProfile">Global Function Routino_GetProfile()</a></h4>
+<h4 id="H_1_3_4_9"><a name="func-Routino_GetProfile">Global Function Routino_GetProfile()</a></h4>
 
 <p>
 <span class="cxref-function-comment">  Select a specific routing profile from the set of Routino profiles that have been loaded from the XML file or NULL in case of an error.</span>
@@ -823,7 +838,7 @@ the software is distributed or interacted with over a network.
   <dd><span class="cxref-function-comment">The name of the profile to select.</span>
 </dl>
 
-<h4><a name="func-Routino_GetProfileNames">Global Function Routino_GetProfileNames()</a></h4>
+<h4 id="H_1_3_4_10"><a name="func-Routino_GetProfileNames">Global Function Routino_GetProfileNames()</a></h4>
 
 <p>
 <span class="cxref-function-comment">  Return a list of the profile names that have been loaded from the XML file.</span>
@@ -835,7 +850,7 @@ the software is distributed or interacted with over a network.
   <dd><span class="cxref-function-comment">Returns a NULL terminated list of strings - all allocated.</span>
 </dl>
 
-<h4><a name="func-Routino_GetTranslation">Global Function Routino_GetTranslation()</a></h4>
+<h4 id="H_1_3_4_11"><a name="func-Routino_GetTranslation">Global Function Routino_GetTranslation()</a></h4>
 
 <p>
 <span class="cxref-function-comment">  Select a specific translation from the set of Routino translations that have been loaded from the XML file or NULL in case of an error.</span>
@@ -849,7 +864,7 @@ the software is distributed or interacted with over a network.
   <dd><span class="cxref-function-comment">The language to select (as a country code, e.g. 'en', 'de') or an empty string for the first in the file or NULL for the built-in English version.</span>
 </dl>
 
-<h4><a name="func-Routino_GetTranslationLanguageFullNames">Global Function Routino_GetTranslationLanguageFullNames()</a></h4>
+<h4 id="H_1_3_4_12"><a name="func-Routino_GetTranslationLanguageFullNames">Global Function Routino_GetTranslationLanguageFullNames()</a></h4>
 
 <p>
 <span class="cxref-function-comment">  Return a list of the full names of the translation languages that have been loaded from the XML file.</span>
@@ -861,7 +876,7 @@ the software is distributed or interacted with over a network.
   <dd><span class="cxref-function-comment">Returns a NULL terminated list of strings - all allocated.</span>
 </dl>
 
-<h4><a name="func-Routino_GetTranslationLanguages">Global Function Routino_GetTranslationLanguages()</a></h4>
+<h4 id="H_1_3_4_13"><a name="func-Routino_GetTranslationLanguages">Global Function Routino_GetTranslationLanguages()</a></h4>
 
 <p>
 <span class="cxref-function-comment">  Return a list of the translation languages that have been loaded from the XML file.</span>
@@ -873,7 +888,7 @@ the software is distributed or interacted with over a network.
   <dd><span class="cxref-function-comment">Returns a NULL terminated list of strings - all allocated.</span>
 </dl>
 
-<h4><a name="func-Routino_LoadDatabase">Global Function Routino_LoadDatabase()</a></h4>
+<h4 id="H_1_3_4_14"><a name="func-Routino_LoadDatabase">Global Function Routino_LoadDatabase()</a></h4>
 
 <p>
 <span class="cxref-function-comment">  Load a database of files for Routino to use for routing.</span>
@@ -889,7 +904,7 @@ the software is distributed or interacted with over a network.
   <dd><span class="cxref-function-comment">The prefix of the database files.</span>
 </dl>
 
-<h4><a name="func-Routino_ParseXMLProfiles">Global Function Routino_ParseXMLProfiles()</a></h4>
+<h4 id="H_1_3_4_15"><a name="func-Routino_ParseXMLProfiles">Global Function Routino_ParseXMLProfiles()</a></h4>
 
 <p>
 <span class="cxref-function-comment">  Parse a Routino XML file containing profiles, must be called before selecting a profile.</span>
@@ -903,7 +918,7 @@ the software is distributed or interacted with over a network.
   <dd><span class="cxref-function-comment">The full pathname of the file to read.</span>
 </dl>
 
-<h4><a name="func-Routino_ParseXMLTranslations">Global Function Routino_ParseXMLTranslations()</a></h4>
+<h4 id="H_1_3_4_16"><a name="func-Routino_ParseXMLTranslations">Global Function Routino_ParseXMLTranslations()</a></h4>
 
 <p>
 <span class="cxref-function-comment">  Parse a Routino XML file containing translations, must be called before selecting a translation.</span>
@@ -917,7 +932,7 @@ the software is distributed or interacted with over a network.
   <dd><span class="cxref-function-comment">The full pathname of the file to read.</span>
 </dl>
 
-<h4><a name="func-Routino_UnloadDatabase">Global Function Routino_UnloadDatabase()</a></h4>
+<h4 id="H_1_3_4_17"><a name="func-Routino_UnloadDatabase">Global Function Routino_UnloadDatabase()</a></h4>
 
 <p>
 <span class="cxref-function-comment">  Close the database files that were opened by a call to Routino_LoadDatabase().</span>
@@ -929,7 +944,7 @@ the software is distributed or interacted with over a network.
   <dd><span class="cxref-function-comment">The database to close.</span>
 </dl>
 
-<h4><a name="func-Routino_ValidateProfile">Global Function Routino_ValidateProfile()</a></h4>
+<h4 id="H_1_3_4_18"><a name="func-Routino_ValidateProfile">Global Function Routino_ValidateProfile()</a></h4>
 
 <p>
 <span class="cxref-function-comment">  Validates that a selected routing profile is valid for use with the selected routing database.</span>
diff --git a/doc/html/readme.html b/doc/html/readme.html
index 3795486..cda3628 100644
--- a/doc/html/readme.html
+++ b/doc/html/readme.html
@@ -12,7 +12,7 @@
 
  Part of the Routino routing software.
 
- This file Copyright 2008-2015 Andrew M. Bishop
+ This file Copyright 2008-2016 Andrew M. Bishop
 
  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU Affero General Public License as published by
@@ -210,55 +210,56 @@ Version 2.7.2 of Routino was released on 26th June 2014.
 Version 2.7.3 of Routino was released on 8th November 2014.
 <br>
 Version 3.0 of Routino was released on 12th September 2015.
+<br>
+Version 3.1 of Routino was released on 5th March 2016.
 
 <p>
 
 The full version history is available in the NEWS.txt file.
 
 
-<h3 id="H_1_5_1" title="Changes 3.0">Changes in Versions 3.0</h3>
-
-Version 3.0 - Windows compilation and library providing routing API.
+<h3 id="H_1_5_1" title="Changes 3.1">Changes in Versions 3.1</h3>
 
 <dl>
   <dt>Bug fixes:
-    <dd>Use a single definition of MAX_SEG_PER_NODE to avoid confusion.
-    <br>Fix bug with built-in translation strings if no XML translations available.
-    <br>Fix bug with makefiles related to creating new translations.
-    <br>Remove some pthread code that was still there when compiling without pthreads.
-    <br>Fix a use-after-free memory error and use of uninitialised allocated memory.
-    <br>Ensure that allocated strings are long enough for temporary filenames.
-
-  <dt>Programs:
-    <dd>Add a '--version' option to all of the programs.
-
-  <dt>Source Code:
-    <dd>Various C language cleanups including using '-pedantic' compiler option.
-    <br>Various changes to allow compiling with Microsoft Visual Studio C compiler.
-    <br>Various changes to allow compiling with MinGW or Cygwin on Microsoft Windows.
-    <br>Makefile updates: 'make clean' = release, 'make distclean' = SVN repository.
-
-  <dt>API:
-    <dd>Create a library API that can perform routing functions.
-
-  <dt>OSM tagging:
-    <dd>Remove cycle_barrier and bicycle_barrier since they do not block bicycles.
+    <dd>Make the whole of the highlighted entry on the webpage clickable.
+    <br>Fix Makefiles so that 'make -j 4' works.
+    <br>Fix Makefiles so that 'make test' works from a clean directory.
+    <br>Fix bug on webpage with 'oneway' or 'turns' in the URL arguments.
+    <br>Print error message on webpage if geolocation function unavailable.
+    <br>Fix bug where the optimum end of the route was not being found.
+    <br>Reduce the preference for service roads in the default routing profile.
+    <br>Remove literal type conversion error when validating profile values.
+
+  <dt>Library:
+    <dd>Add a version number to the shared library (SONAME).
+    <br>Include the version number of Routino into the library as a string variable.
+    <br>Add loop and reverse route as options to the library.
+
+  <dt>planetsplitter:
+    <dd>Use 64-bit numbers for the node ID when processing an OSM file.
+
+  <dt>router:
+    <dd>Change file output formats so that waypoint numbers are included.
+    <br>When calculating a route with loop and reverse start route from waypoint 1.
+    <br>Calculate the route from both ends towards the middle.
 
   <dt>Translations:
-    <dd>Updated Dutch and German translations.
-    <br>Added Hungarian and Polish translations provided through translation web page.
+    <dd>Change the names of the GPX route waypoints in translations.xml.
+    <br>Updated French and German translations.
 
-  <dt>Documentation:
-    <dd>Add meta tags to HTML to help mobile devices, tidy up the CSS.
-    <br>Create instructions for compiling on Microsoft Windows.
-    <br>Create API description for Routino library usage.
+  <dt>Documentation
+    <dd>Updated the instructions for setting up on Apache (version 2.4.x).
 
   <dt>Web pages:
-    <dd>Allow drag-and-drop of waypoints within the list and onto the map.
+    <dd>Add a loop & reverse checkbox, replace loop & reverse buttons with icons.
+
+  <dt>Extras:
+    <dd>Add scripts to process the database and create maps of highway statistics.
 </dl>
 
 <p>
-<b>Note:</b> This version is compatible with databases from version 2.7.1 - 2.7.3.
+<b>Note:</b> This version is compatible with databases from version 2.7.1 - 3.0.
 
 
 <h2 id="H_1_6">License</h2>
@@ -279,7 +280,7 @@ software.
 
 <h3 id="H_1_6_1">Copyright</h3>
 
-Routino is copyright Andrew M. Bishop 2008-2015.
+Routino is copyright Andrew M. Bishop 2008-2016.
 
 
 <h2 id="H_1_7">Homepage</h2>
diff --git a/extras/find-fixme/Makefile b/extras/find-fixme/Makefile
index fbd9baf..55b31b3 100644
--- a/extras/find-fixme/Makefile
+++ b/extras/find-fixme/Makefile
@@ -2,7 +2,7 @@
 #
 # Part of the Routino routing software.
 #
-# This file Copyright 2013-2015 Andrew M. Bishop
+# This file Copyright 2013-2016 Andrew M. Bishop
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU Affero General Public License as published by
@@ -30,8 +30,10 @@ WEBWWWDIR=web/www
 
 # Compilation targets
 
+DEPDIR=.deps
+
 C=$(wildcard *.c)
-D=$(wildcard .deps/*.d)
+D=$(wildcard $(DEPDIR)/*.d)
 
 ROUTINO_SRC=../../src
 ROUTINO_WEBWWWDIR=../../web/www/routino
@@ -147,12 +149,12 @@ $(ROUTINO_SRC)/%-slim.o :
 	cd $(ROUTINO_SRC) && $(MAKE) $(notdir $@)
 
 %.o : %.c
-	@[ -d .deps ] || mkdir .deps
-	$(CC) -c $(CFLAGS) -DSLIM=0 -I$(ROUTINO_SRC) $< -o $@ -MMD -MP -MF $(addprefix .deps/,$(addsuffix .d,$(basename $@)))
+	-@[ -d $(DEPDIR) ] || mkdir $(DEPDIR)
+	$(CC) -c $(CFLAGS) -DSLIM=0 -I$(ROUTINO_SRC) $< -o $@ -MMD -MP -MF $(addprefix $(DEPDIR)/,$(addsuffix .d,$(basename $@)))
 
 %-slim.o : %.c
-	@[ -d .deps ] || mkdir .deps
-	$(CC) -c $(CFLAGS) -DSLIM=1 -I$(ROUTINO_SRC) $< -o $@ -MMD -MP -MF $(addprefix .deps/,$(addsuffix .d,$(basename $@)))
+	-@[ -d $(DEPDIR) ] || mkdir $(DEPDIR)
+	$(CC) -c $(CFLAGS) -DSLIM=1 -I$(ROUTINO_SRC) $< -o $@ -MMD -MP -MF $(addprefix $(DEPDIR)/,$(addsuffix .d,$(basename $@)))
 
 ########
 
@@ -173,7 +175,7 @@ clean:
 	cd $(WEBWWWDIR) && rm -f $(DOC_COPY)
 	rm -f $(EXE)
 	rm -f $(D)
-	rm -fr .deps
+	rm -fr $(DEPDIR)
 	rm -f core
 
 ########
diff --git a/extras/find-fixme/web/www/.htaccess b/extras/find-fixme/web/www/.htaccess
new file mode 100644
index 0000000..16d9684
--- /dev/null
+++ b/extras/find-fixme/web/www/.htaccess
@@ -0,0 +1,32 @@
+##
+## Options for Apache web server for language specific web pages and to run
+## Routino Fixme-finder CGI script.
+##
+
+# For some of the configuration options in this file to be accepted the
+# 'AllowOverride' option in the main Apache configuration file must be set to a
+# particular value.  A suitable value for the 'AllowOverride' option is
+# 'Options=MultiViews,ExecCGI FileInfo Limit' which will allow this file to be
+# used unmodified.  Alternatively the specific option can be commented out from
+# this file and set in the main Apache configuration file.
+
+
+# The Routino CGI scripts are stored in this directory and use the filename
+# extension ".cgi".  This filename extension needs to be registered with Apache
+# for the scripts to be executed.
+
+AddHandler cgi-script .cgi
+
+# The ExecCGI option must be set for the CGIs in this directory to be executed
+# by Apache.
+
+Options +ExecCGI
+
+# The CGI scripts that are used by Routino also call some other Perl scripts, to
+# stop these scripts from being seen by web users they can be denied by the
+# following entry.
+
+<FilesMatch .*\.pl$>
+   Order Deny,Allow
+   Deny from all
+</FilesMatch>
diff --git a/extras/find-fixme/web/www/fixme.html b/extras/find-fixme/web/www/fixme.html
index f221918..bb76ef7 100644
--- a/extras/find-fixme/web/www/fixme.html
+++ b/extras/find-fixme/web/www/fixme.html
@@ -13,7 +13,7 @@
 
  Part of the Routino routing software.
 
- This file Copyright 2008-2014 Andrew M. Bishop
+ This file Copyright 2008-2015 Andrew M. Bishop
 
  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU Affero General Public License as published by
@@ -132,7 +132,7 @@
     <div class="hideshow_box">
       <span class="hideshow_title">Statistics</span>
       <div id="statistics_data"></div>
-      <a id="statistics_link" href="statistics.cgi" onclick="displayStatistics();return(false);">Display data statistics</a>
+      <a id="statistics_link" href="fixme.cgi?statistics=yes" onclick="displayStatistics();return(false);">Display data statistics</a>
     </div>
   </div>
 
diff --git a/extras/tagmodifier/Makefile b/extras/statistics/Makefile
similarity index 51%
copy from extras/tagmodifier/Makefile
copy to extras/statistics/Makefile
index b61014a..bc60090 100644
--- a/extras/tagmodifier/Makefile
+++ b/extras/statistics/Makefile
@@ -1,8 +1,8 @@
-# tagmodifier Makefile
+# database-stats Makefile
 #
 # Part of the Routino routing software.
 #
-# This file Copyright 2013-2015 Andrew M. Bishop
+# This file Copyright 2008-2016 Andrew M. Bishop
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU Affero General Public License as published by
@@ -24,28 +24,43 @@ include ../../Makefile.conf
 
 # Compilation targets
 
+DEPDIR=.deps
+
 C=$(wildcard *.c)
-D=$(wildcard .deps/*.d)
+D=$(wildcard $(DEPDIR)/*.d)
 
 ROUTINO_SRC=../../src
 
-EXE=tagmodifier$(.EXE)
+EXE=dumper$(.EXE) dumper-slim$(.EXE)
 
 ########
 
-all: $(EXE)
+all : $(EXE)
 
 ########
 
-TAGMODIFIER_OBJ=tagmodifier.o \
-	        $(ROUTINO_SRC)/files.o $(ROUTINO_SRC)/logging.o $(ROUTINO_SRC)/logerror.o \
-	        $(ROUTINO_SRC)/uncompress.o $(ROUTINO_SRC)/xmlparse.o $(ROUTINO_SRC)/tagging.o
+DUMPER_OBJ=dumper.o \
+	   $(ROUTINO_SRC)/nodes.o $(ROUTINO_SRC)/segments.o $(ROUTINO_SRC)/ways.o \
+	   $(ROUTINO_SRC)/files.o $(ROUTINO_SRC)/fakes.o $(ROUTINO_SRC)/logging.o \
+           $(ROUTINO_SRC)/sorting.o
+
+ifeq ($(HOST),MINGW)
+DUMPER_OBJ+=$(ROUTINO_SRC)/mman-win32.o
+endif
+
+dumper$(.EXE) : $(DUMPER_OBJ)
+	$(LD) $^ -o $@ $(LDFLAGS)
+
+DUMPER_SLIM_OBJ=dumper-slim.o \
+	   $(ROUTINO_SRC)/nodes-slim.o $(ROUTINO_SRC)/segments-slim.o $(ROUTINO_SRC)/ways-slim.o \
+	   $(ROUTINO_SRC)/files.o $(ROUTINO_SRC)/fakes.o $(ROUTINO_SRC)/logging.o \
+           $(ROUTINO_SRC)/sorting.o
 
 ifeq ($(HOST),MINGW)
-TAGMODIFIER_OBJ+=$(ROUTINO_SRC)/mman-win32.o
+DUMPER_SLIM_OBJ+=$(ROUTINO_SRC)/mman-win32.o
 endif
 
-tagmodifier$(.EXE) : $(TAGMODIFIER_OBJ)
+dumper-slim$(.EXE) : $(DUMPER_SLIM_OBJ)
 	$(LD) $^ -o $@ $(LDFLAGS)
 
 ########
@@ -53,9 +68,16 @@ tagmodifier$(.EXE) : $(TAGMODIFIER_OBJ)
 $(ROUTINO_SRC)/%.o :
 	cd $(ROUTINO_SRC) && $(MAKE) $(notdir $@)
 
+$(ROUTINO_SRC)/%-slim.o :
+	cd $(ROUTINO_SRC) && $(MAKE) $(notdir $@)
+
 %.o : %.c
-	@[ -d .deps ] || mkdir .deps
-	$(CC) -c $(CFLAGS) -DSLIM=0 -I$(ROUTINO_SRC) $< -o $@ -MMD -MP -MF $(addprefix .deps/,$(addsuffix .d,$(basename $@)))
+	-@[ -d $(DEPDIR) ] || mkdir $(DEPDIR)
+	$(CC) -c $(CFLAGS) -DSLIM=0 -I$(ROUTINO_SRC) $< -o $@ -MMD -MP -MF $(addprefix $(DEPDIR)/,$(addsuffix .d,$(basename $@)))
+
+%-slim.o : %.c
+	-@[ -d $(DEPDIR) ] || mkdir $(DEPDIR)
+	$(CC) -c $(CFLAGS) -DSLIM=1 -I$(ROUTINO_SRC) $< -o $@ -MMD -MP -MF $(addprefix $(DEPDIR)/,$(addsuffix .d,$(basename $@)))
 
 ########
 
@@ -72,8 +94,9 @@ clean:
 	rm -f *.o
 	rm -f $(EXE)
 	rm -f $(D)
-	rm -fr .deps
+	rm -fr $(DEPDIR)
 	rm -f core
+	rm -f *.png
 
 ########
 
diff --git a/extras/statistics/README.txt b/extras/statistics/README.txt
new file mode 100644
index 0000000..936bbed
--- /dev/null
+++ b/extras/statistics/README.txt
@@ -0,0 +1,22 @@
+                               Database Statistics
+                               ===================
+
+The Routino database is a concentrated source of information about the highways
+in the selected region.  By stepping through the database the properties of each
+segment can be checked and recorded.
+
+The scripts and program here group the data into regions that correspond to the
+standard OSM tiles (default of a zoom 13 tile).  The highway properties are
+written out to a text file indexed by tile position.  A separate Perl script is
+provided to create "heatmap" images from this data which is overlayed on a base
+map created from standard OSM tiles.
+
+The Perl scripts 'create-basemap.pl' and 'create-image.pl' will need modifying
+to set the range of coordinates (quoted as x and y values for zoom level 8
+tiles) to plot and the zoom level of the basemap and data granularity.
+
+The shell script 'update.sh' will need modifying to set the location of the
+Routino database and the zoom level of the data analysis.
+
+The script 'update.sh' will perform all the actions to dump the database into a
+text file, create the basemap and plot the data over the top.
diff --git a/extras/statistics/create-basemap.pl b/extras/statistics/create-basemap.pl
new file mode 100755
index 0000000..b0aa0e0
--- /dev/null
+++ b/extras/statistics/create-basemap.pl
@@ -0,0 +1,93 @@
+#!/usr/bin/perl
+#
+# Base map creation Perl script
+#
+# Part of the Routino routing software.
+#
+# This file Copyright 2008-2016 Andrew M. Bishop
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+use Graphics::Magick;
+
+# Range and source of tiles - PARAMETERS THAT CAN BE EDITED
+
+$baseurl='http://a.tile.openstreetmap.org/${z}/${x}/${y}.png'; # URL of tile server.
+
+ at xrange=(120..129);             # At zoom level 8
+ at yrange=(73..87);               # At zoom level 8
+
+$zbase=6;                       # Zoom level of images to use.
+
+# Base image dimensions
+
+$basescale=2**(8-$zbase);
+$tilesize=256/$basescale;
+
+$width =(1+$#xrange)*$tilesize;
+$height=(1+$#yrange)*$tilesize;
+
+# Create a new base image
+
+$image=Graphics::Magick->new(size => "${width}x${height}");
+$image->ReadImage('xc:white');
+
+$xb=-1;
+
+foreach $x (@xrange)
+  {
+   $xbase=int($x/$basescale);
+
+   next if($xbase==$xb);
+
+   $yb=-1;
+
+   foreach $y (@yrange)
+     {
+      $ybase=int($y/$basescale);
+
+      next if($ybase==$yb);
+
+      $tile=Graphics::Magick->new;
+
+      $url=$baseurl;
+      $url =~ s%\$\{x\}%$xbase%;
+      $url =~ s%\$\{y\}%$ybase%;
+      $url =~ s%\$\{z\}%$zbase%;
+
+      `wget $url -O ${xbase}_${ybase}.png > /dev/null 2>&1`;
+
+      $tile->Read("${xbase}_${ybase}.png");
+
+      unlink "${xbase}_${ybase}.png";
+
+      $xpos=(($xbase*$basescale)-$xrange[0])*$tilesize;
+      $ypos=(($ybase*$basescale)-$yrange[0])*$tilesize;
+
+      $image->Composite(image => $tile, compose => Over, x => $xpos, y => $ypos);
+
+      undef $tile;
+
+      $yb=$ybase;
+     }
+
+   $xb=$xbase;
+  }
+
+print "Writing 'basemap.png'\n";
+
+$image->Write("basemap.png");
+
+undef $image;
diff --git a/extras/statistics/create-image.pl b/extras/statistics/create-image.pl
new file mode 100755
index 0000000..5da2763
--- /dev/null
+++ b/extras/statistics/create-image.pl
@@ -0,0 +1,270 @@
+#!/usr/bin/perl
+#
+# OSM data statistics Perl script
+#
+# Part of the Routino routing software.
+#
+# This file Copyright 2008-2016 Andrew M. Bishop
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+use Graphics::Magick;
+
+# Range of tiles and zoom - PARAMETERS THAT CAN BE EDITED
+
+ at xrange=(120..129);             # At zoom level 8
+ at yrange=(73..87);               # At zoom level 8
+
+$zbase=6;                       # Zoom level of images in basemap.
+
+$z=13;                          # Granularity of data points.
+
+# Base image dimensions
+
+$basescale=2**(8-$zbase);
+
+$width =(1+$#xrange)*256/$basescale;
+$height=(1+$#yrange)*256/$basescale;
+
+# Chosen zoom level
+
+$scale=2**(8-$z);
+$tilesize=256*$scale/$basescale;
+
+# Get the command line arguments
+
+$prefix=$ARGV[0];
+$name  =$ARGV[1];
+$number=$ARGV[2]+0;
+
+# Graph annotations
+
+$annotation{highway}  ="'highway=$name'";
+$annotation{property} ="$name property";
+$annotation{speed}    ="'maxspeed=$name'";
+$annotation{transport}="$name allowed";
+
+# Read in the data
+
+%density=();
+
+while(<STDIN>)
+  {
+   ($x,$y, at distances)=split(/ +/);
+
+   $distance=$distances[$number];
+
+   if($distance > 0)
+     {
+      $area=&xy_area($z,$x,$y);
+
+      $density{$x,$y}=($distance/$area);
+     }
+  }
+
+# Find the maximum value
+
+$max=0;
+
+foreach $xy (keys %density)
+  {
+   $density=$density{$xy};
+
+   $max=$density if($density>$max);
+  }
+
+$max=500.0*int(($max+499)/500);
+$max=500.0 if($max<500);
+
+# Create the overlay image
+
+$colour0=&colour(0);
+
+$image=Graphics::Magick->new(size => "${width}x${height}");
+$image->ReadImage("xc:$colour0");
+
+foreach $xy (keys %density)
+  {
+   ($x,$y)=split($;,$xy);
+
+   $colour=&colour($density{$x,$y}/$max);
+
+   $x1=(($x*$scale)-$xrange[0])*256/$basescale;
+   $y1=(($y*$scale)-$yrange[0])*256/$basescale;
+
+   if($tilesize==1)
+     {
+      $image->Draw(primitive => 'point', points => "$x1,$y1",
+                   fill => $colour,
+                   antialias => 'false');
+     }
+   else
+     {
+      $x2=$x1+$tilesize-1;
+      $y2=$y1+$tilesize-1;
+
+      $image->Draw(primitive => 'rectangle', points => "$x1,$y1 $x2,$y2",
+                   strokewidth => 0, stroke => $colour, fill => $colour,
+                   antialias => 'false');
+     }
+  }
+
+# Create the scale indicator
+
+$indicator=Graphics::Magick->new(size => "${width}x40");
+$indicator->ReadImage('xc:white');
+
+foreach $v (0..($width-2*5))
+  {
+   $x=$v+5;
+   $y1=12; $y2=23;
+   $density=$v/($width-2*5);
+
+   $indicator->Draw(primitive => 'line', points => "$x,$y1,$x,$y2",
+                    stroke => &colour($density),
+                    antialias => 'false');
+  }
+
+$indicator->Annotate(text => "0", font => 'Helvetica', pointsize => '12', style => Normal,
+                     fill => 'black',
+                     x => 5, y => 11, align => Left);
+
+foreach $frac (0.25,0.5,0.75)
+  {
+   $indicator->Annotate(text => $max*$frac, font => 'Helvetica', pointsize => '12', style => Normal,
+                        fill => 'black',
+                        x => 5+($width-2*5)*$frac, y => 11, align => Center);
+  }
+
+$indicator->Annotate(text => $max, font => 'Helvetica', pointsize => '12', style => Normal,
+                     fill => 'black',
+                     x => $width-5, y => 11, align => Right);
+
+$indicator->Annotate(text => "Highway density (metres/square km) for $annotation{$prefix} per zoom $z tile", font => 'Helvetica', pointsize => '14', style => Normal,
+                     fill => 'black',
+                     x => $width/2, y => 36, align => Center);
+
+# Create the combined images
+
+$base=Graphics::Magick->new;
+$base->ReadImage("basemap.png");
+
+$base->Composite(image => $image, compose => Dissolve, x => 0, y => 0, opacity => 50);
+
+$final=Graphics::Magick->new(size => ($base->Get('width')+2)."x".($base->Get('height')+$indicator->Get('height')+3));
+$final->ReadImage('xc:black');
+
+$final->Composite(image => $base     , compose => Over, x => 1, y => 1                     );
+$final->Composite(image => $indicator, compose => Over, x => 1, y => $base->Get('height')+2);
+
+undef $base;
+undef $image;
+undef $indicator;
+
+# Write out the images
+
+print "Writing '$prefix-$name.png'\n";
+
+$final->Write("$prefix-$name.png");
+
+$final->Resize(width => $width/4, height => $final->Get('height')/4);
+$final->Write("$prefix-$name-small.png");
+
+undef $final;
+
+#
+# Subroutines
+#
+
+sub xy_ll_rad
+{
+ my($zoom,$x,$y)=@_;
+
+ $PI=3.14159265358979323846;
+
+ my($longitude)=$PI*(($x * (2**(1-$zoom)))-1);
+ my($latitude)=($PI/2)*((4/$PI)*atan2(exp($PI*(1-($y * (2**(1-$zoom))))),1) - 1);
+
+ return ($longitude,$latitude);
+}
+
+
+sub xy_area
+{
+ my($zoom,$x,$y)=@_;
+
+ $RADIUS=6378.137;
+
+ my($width,$height);
+
+ if(defined $width{$y})
+   {
+    $width=$width{$y};
+   }
+ else
+   {
+    my($lon1,$lat1)=&xy_ll_rad($z,$x  ,$y);
+    my($lon2,$lat2)=&xy_ll_rad($z,$x+1,$y);
+
+    $width=$RADIUS*($lon2-$lon1)*cos($lat1);
+
+    $width{$y}=$width;
+   }
+
+ if(defined $height{$y})
+   {
+    $height=$height{$y};
+   }
+ else
+   {
+    my($lon1,$lat1)=&xy_ll_rad($z,$x,$y  );
+    my($lon2,$lat2)=&xy_ll_rad($z,$x,$y+1);
+
+    $height=$RADIUS*($lat1-$lat2);
+
+    $height{$y}=$height;
+   }
+
+ return $width*$height;
+}
+
+sub colour
+{
+ my($density)=@_;
+
+ $density=sqrt($density);
+
+ $density=0 if($density<0);
+ $density=1 if($density>1);
+
+ my($r,$g,$b);
+
+ if($density<0.5)
+   {
+    $r=0;
+    $g=int(255*(2*$density));
+    $b=int(255*(1-2*$density));
+   }
+ else
+   {
+    $density-=0.5;
+
+    $r=int(255*(2*$density));
+    $g=int(255*(1-2*$density));
+    $b=0;
+   }
+
+ sprintf("#%02x%02x%02x",$r,$g,$b);
+}
diff --git a/extras/statistics/dumper.c b/extras/statistics/dumper.c
new file mode 100644
index 0000000..865d5d1
--- /dev/null
+++ b/extras/statistics/dumper.c
@@ -0,0 +1,503 @@
+/***************************************
+ Data extractor and file dumper.
+
+ Part of the Routino routing software.
+ ******************/ /******************
+ This file Copyright 2008-2016 Andrew M. Bishop
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ ***************************************/
+
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/stat.h>
+#include <sys/time.h>
+#include <time.h>
+#include <math.h>
+
+#include "types.h"
+#include "functions.h"
+#include "nodes.h"
+#include "segments.h"
+#include "ways.h"
+#include "sorting.h"
+
+
+/* Global variables (required to link sorting.c) */
+
+/*+ The command line '--tmpdir' option or its default value. +*/
+char *option_tmpdirname=NULL;
+
+/*+ The amount of RAM to use for filesorting. +*/
+size_t option_filesort_ramsize=0;
+
+/*+ The number of threads to use for filesorting. +*/
+int option_filesort_threads=1;
+
+/* Local types */
+
+typedef struct _crossing
+{
+ double   f;
+ uint32_t x;
+ uint32_t y;
+}
+ crossing;
+
+/* Local functions */
+
+static void ll_xy_rad(int zoom,double longitude,double latitude,double *x,double *y);
+
+static int compare_crossing(crossing *a,crossing *b);
+
+
+/*++++++++++++++++++++++++++++++++++++++
+  The main function.
+  ++++++++++++++++++++++++++++++++++++++*/
+
+int main(int argc,char** argv)
+{
+ Nodes     *OSMNodes;
+ Segments  *OSMSegments;
+ Ways      *OSMWays;
+ int        arg;
+ char      *dirname=NULL,*prefix=NULL;
+ char      *nodes_filename,*segments_filename,*ways_filename;
+ index_t    item;
+ crossing  *crossings=(crossing*)malloc(128*sizeof(crossing));
+ crossing **crossingsp=(crossing**)malloc(128*sizeof(crossing*));
+ float   ***highways,***transports,***properties,***speeds;
+ double     lat,lon,x,y;
+ uint32_t   xmin,ymin,xmax,ymax,xt,yt;
+ int        zoom=13;
+ int        speed_count=0;
+ double     *speed_selection=NULL;
+
+ /* Parse the command line arguments */
+
+ for(arg=1;arg<argc;arg++)
+   {
+    if(!strcmp(argv[arg],"--help"))
+       goto usage;
+    else if(!strncmp(argv[arg],"--dir=",6))
+       dirname=&argv[arg][6];
+    else if(!strncmp(argv[arg],"--prefix=",9))
+       prefix=&argv[arg][9];
+    else if(!strncmp(argv[arg],"--speed=",8))
+      {
+       int i;
+
+       speed_count=1;
+
+       for(i=8;argv[arg][i];i++)
+          if(argv[arg][i]==',')
+             speed_count++;
+
+       speed_selection=calloc(speed_count,sizeof(double));
+
+       speed_count=0;
+
+       for(i=7;argv[arg][i];i++)
+          if(argv[arg][i]==',' || argv[arg][i]=='=')
+             speed_selection[speed_count++]=atof(&argv[arg][i+1]);
+      }
+    else if(!strncmp(argv[arg],"--zoom=",7))
+      {
+       zoom=atoi(&argv[arg][7]);
+
+       if(zoom<10 || zoom>16)
+          goto usage;
+      }
+    else
+      {
+      usage:
+
+       fprintf(stderr,"Usage: dumper\n"
+                      "              [--help]\n"
+                      "              [--dir=<name>] [--prefix=<name>]\n"
+                      "              [--speed=<speed1>,<speed2>,...,<speedN>]"
+                      "              [--zoom=<10-16>]\n");
+
+       return(1);
+      }
+   }
+
+ /* Load in the data */
+
+ OSMNodes=LoadNodeList(nodes_filename=FileName(dirname,prefix,"nodes.mem"));
+
+ if(!OSMNodes)
+   {
+    fprintf(stderr,"Cannot open nodes file '%s'.\n",nodes_filename);
+    return(1);
+   }
+
+ OSMSegments=LoadSegmentList(segments_filename=FileName(dirname,prefix,"segments.mem"));
+
+ if(!OSMSegments)
+   {
+    fprintf(stderr,"Cannot open segments file '%s'.\n",segments_filename);
+    return(1);
+   }
+
+ OSMWays=LoadWayList(ways_filename=FileName(dirname,prefix,"ways.mem"));
+
+ if(!OSMWays)
+   {
+    fprintf(stderr,"Cannot open ways file '%s'.\n",ways_filename);
+    return(1);
+   }
+
+ /* Allocate the arrays */
+
+ lat=latlong_to_radians(bin_to_latlong(OSMNodes->file.latzero));
+ lon=latlong_to_radians(bin_to_latlong(OSMNodes->file.lonzero));
+
+ ll_xy_rad(zoom,lon,lat,&x,&y);
+
+ xmin=(uint32_t)floor(x);
+ ymax=(uint32_t)floor(y);
+
+ lat=latlong_to_radians(bin_to_latlong(OSMNodes->file.latzero+OSMNodes->file.latbins));
+ lon=latlong_to_radians(bin_to_latlong(OSMNodes->file.lonzero+OSMNodes->file.lonbins));
+
+ ll_xy_rad(zoom,lon,lat,&x,&y);
+
+ xmax=(uint32_t)floor(x);
+ ymin=(uint32_t)floor(y);
+
+ highways  =malloc(sizeof(highways[0])  *(xmax-xmin+1));
+ transports=malloc(sizeof(transports[0])*(xmax-xmin+1));
+ properties=malloc(sizeof(properties[0])*(xmax-xmin+1));
+ speeds    =malloc(sizeof(speeds[0])    *(xmax-xmin+1));
+
+ for(xt=xmin;xt<=xmax;xt++)
+   {
+    highways[xt-xmin]  =malloc(sizeof(highways[0][0])  *(ymax-ymin+1));
+    transports[xt-xmin]=malloc(sizeof(transports[0][0])*(ymax-ymin+1));
+    properties[xt-xmin]=malloc(sizeof(properties[0][0])*(ymax-ymin+1));
+    speeds[xt-xmin]    =malloc(sizeof(speeds[0][0])    *(ymax-ymin+1));
+
+    for(yt=ymin;yt<=ymax;yt++)
+      {
+       highways[xt-xmin][yt-ymin]  =calloc((Highway_Count-1)  ,sizeof(highways[0][0][0])  );
+       transports[xt-xmin][yt-ymin]=calloc((Transport_Count-1),sizeof(transports[0][0][0]));
+       properties[xt-xmin][yt-ymin]=calloc((Property_Count+1) ,sizeof(properties[0][0][0]));
+       speeds[xt-xmin][yt-ymin]    =calloc((speed_count)      ,sizeof(speeds[0][0][0])    );
+      }
+   }
+
+ /* Dump the segments out with lat/long in tile units. */
+
+ for(item=0;item<OSMSegments->file.number;item++)
+   {
+    Segment *segment=LookupSegment(OSMSegments,item,1);
+
+    if(IsNormalSegment(segment))
+      {
+       double latitude1,longitude1,latitude2,longitude2;
+       double x1,y1,x2,y2;
+       uint32_t xi1,yi1,xi2,yi2;
+       Way *way;
+       double distance;
+
+       /* Get the coordinates */
+
+       distance=1000*distance_to_km(DISTANCE(segment->distance));
+
+       GetLatLong(OSMNodes,segment->node1,NULL,&latitude1,&longitude1);
+
+       GetLatLong(OSMNodes,segment->node2,NULL,&latitude2,&longitude2);
+
+       way=LookupWay(OSMWays,segment->way,1);
+
+       ll_xy_rad(zoom,longitude1,latitude1,&x1,&y1);
+       ll_xy_rad(zoom,longitude2,latitude2,&x2,&y2);
+
+       /* Map to tiles and find tile crossings */
+
+       xi1=(uint32_t)floor(x1);
+       yi1=(uint32_t)floor(y1);
+
+       xi2=(uint32_t)floor(x2);
+       yi2=(uint32_t)floor(y2);
+
+       if(xi1==xi2 && yi1==yi2)
+         {
+          int j;
+
+          for(j=1;j<Highway_Count;j++)
+             if(HIGHWAY(way->type) == j)
+                highways[xi1-xmin][yi1-ymin][j-1]+=distance;
+
+          for(j=1;j<Transport_Count;j++)
+             if(way->allow & TRANSPORTS(j))
+                transports[xi1-xmin][yi1-ymin][j-1]+=distance;
+
+          for(j=1;j<Property_Count;j++)
+             if(way->props & PROPERTIES(j))
+                properties[xi1-xmin][yi1-ymin][j-1]+=distance;
+
+          if(way->type & Highway_CycleBothWays)
+             properties[xi1-xmin][yi1-ymin][Property_Count-1]+=distance;
+
+          if(way->type & Highway_OneWay)
+             properties[xi1-xmin][yi1-ymin][Property_Count]+=distance;
+
+          for(j=0;j<speed_count;j++)
+             if(speed_to_kph(way->speed) == speed_selection[j])
+                speeds[xi1-xmin][yi1-ymin][j]+=distance;
+         }
+       else
+         {
+          int crossing_count=2,i;
+          double lastf;
+          uint32_t lastx,lasty;
+
+          crossings[0].f=0.0;
+          crossings[0].x=xi1;
+          crossings[0].y=yi1;
+
+          crossings[1].f=1.0;
+          crossings[1].x=xi2;
+          crossings[1].y=yi2;
+
+          /* Find X boundaries */
+
+          if(xi1!=xi2)
+            {
+             uint32_t x,minx,maxx;
+
+             if(xi1<xi2)
+               {
+                minx=xi1+1;
+                maxx=xi2;
+               }
+             else
+               {
+                minx=xi2+1;
+                maxx=xi1;
+               }
+
+             for(x=minx;x<=maxx;x++)
+               {
+                double fraction=(double)(x-x1)/(double)(x2-x1);
+                uint32_t y=(uint32_t)(y1+fraction*(y2-y1));
+
+                crossings[crossing_count].f=fraction;
+                crossings[crossing_count].x=x;
+                crossings[crossing_count].y=y;
+                crossing_count++;
+               }
+            }
+
+          /* Find Y boundaries */
+
+          if(yi1!=yi2)
+            {
+             uint32_t y,miny,maxy;
+
+             if(yi1<yi2)
+               {
+                miny=yi1+1;
+                maxy=yi2;
+               }
+             else
+               {
+                miny=yi2+1;
+                maxy=yi1;
+               }
+
+             for(y=miny;y<=maxy;y++)
+               {
+                double fraction=(double)(y-y1)/(double)(y2-y1);
+                uint32_t x=(uint32_t)(x1+fraction*(x2-x1));
+
+                crossings[crossing_count].f=fraction;
+                crossings[crossing_count].x=x;
+                crossings[crossing_count].y=y;
+                crossing_count++;
+               }
+            }
+
+          /* Sort the boundaries */
+
+          for(i=0;i<crossing_count;i++)
+             crossingsp[i]=&crossings[i];
+
+          filesort_heapsort((void**)crossingsp,crossing_count,(int (*)(const void*,const void*))compare_crossing);
+
+          /* Partition the data among the tiles */
+
+          lastf=crossingsp[0]->f;
+          lastx=crossingsp[0]->x;
+          lasty=crossingsp[0]->y;
+
+          for(i=1;i<crossing_count;i++)
+            {
+             double f=crossingsp[i]->f;
+             uint32_t xi,x=crossingsp[i]->x;
+             uint32_t yi,y=crossingsp[i]->y;
+             double d;
+             int j;
+
+             xi=x;
+             if(lastx<x) xi=lastx;
+
+             yi=y;
+             if(lasty<y) yi=lasty;
+
+             d=distance*(f-lastf);
+
+             for(j=1;j<Highway_Count;j++)
+                if(HIGHWAY(way->type) == j)
+                   highways[xi-xmin][yi-ymin][j-1]+=d;
+
+             for(j=1;j<Transport_Count;j++)
+                if(way->allow & TRANSPORTS(j))
+                   transports[xi-xmin][yi-ymin][j-1]+=d;
+
+             for(j=1;j<Property_Count;j++)
+                if(way->props & PROPERTIES(j))
+                   properties[xi-xmin][yi-ymin][j-1]+=d;
+
+             if(way->type & Highway_CycleBothWays)
+                properties[xi1-xmin][yi1-ymin][Property_Count-1]+=distance;
+
+             if(way->type & Highway_OneWay)
+                properties[xi1-xmin][yi1-ymin][Property_Count]+=distance;
+
+             for(j=0;j<speed_count;j++)
+                if(speed_to_kph(way->speed) == speed_selection[j])
+                   speeds[xi1-xmin][yi1-ymin][j]+=distance;
+
+             lastf=f;
+             lastx=x;
+             lasty=y;
+            }
+         }
+      }
+   }
+
+ /* Print the results */
+
+ for(xt=xmin;xt<=xmax;xt++)
+   {
+    for(yt=ymin;yt<=ymax;yt++)
+      {
+       int do_highways=0,do_transports=0,do_properties=0;
+       int j;
+
+       for(j=1;j<Highway_Count;j++)
+          if(highways[xt-xmin][yt-ymin][j-1] > 0)
+             do_highways++;
+
+       for(j=1;j<Transport_Count;j++)
+          if(transports[xt-xmin][yt-ymin][j-1] > 0)
+             do_transports++;
+
+       for(j=1;j<Property_Count;j++)
+          if(properties[xt-xmin][yt-ymin][j-1] > 0)
+             do_properties++;
+
+       if(do_highways || do_transports || do_properties)
+         {
+          printf("%d %d",xt,yt);
+
+          for(j=1;j<Highway_Count;j++)
+             printf(" %.2f",highways[xt-xmin][yt-ymin][j-1]);
+
+          for(j=1;j<Transport_Count;j++)
+             printf(" %.2f",transports[xt-xmin][yt-ymin][j-1]);
+
+          for(j=1;j<=Property_Count+1;j++)
+             printf(" %.2f",properties[xt-xmin][yt-ymin][j-1]);
+
+          for(j=0;j<speed_count;j++)
+             printf(" %.2f",speeds[xt-xmin][yt-ymin][j]);
+
+          printf("\n");
+         }
+
+       free(highways[xt-xmin][yt-ymin]);
+       free(transports[xt-xmin][yt-ymin]);
+       free(properties[xt-xmin][yt-ymin]);
+       free(speeds[xt-xmin][yt-ymin]);
+      }
+
+    free(highways[xt-xmin]);
+    free(transports[xt-xmin]);
+    free(properties[xt-xmin]);
+    free(speeds[xt-xmin]);
+   }
+
+ free(highways);
+ free(transports);
+ free(properties);
+ free(speeds);
+
+ free(speed_selection);
+
+ return(0);
+}
+
+
+/*++++++++++++++++++++++++++++++++++++++
+  Sort the tile edge crossings into order.
+
+  int compare_crossing Returns the comparison of the fraction (f) field.
+
+  crossing *a The first boundary crossing.
+
+  crossing *b The second boundary crossing.
+  ++++++++++++++++++++++++++++++++++++++*/
+
+static int compare_crossing(crossing *a,crossing *b)
+{
+ double ad=a->f;
+ double bd=b->f;
+
+ if(ad<bd)
+    return(-1);
+ else if(ad>bd)
+    return(1);
+ else
+    return(-FILESORT_PRESERVE_ORDER(a,b)); /* latest version first */
+}
+
+
+/*++++++++++++++++++++++++++++++++++++++
+  Convert latitude and longitude into tile coordinates.
+
+  int zoom The zoom level.
+
+  double longitude The latitude of the point.
+
+  double latitude The longitude of the point.
+
+  double *x The tile X number (including fractional part).
+
+  double *y The tile Y number (including fractional part).
+  ++++++++++++++++++++++++++++++++++++++*/
+
+static void ll_xy_rad(int zoom,double longitude,double latitude,double *x,double *y)
+{
+ *x=longitude/M_PI+1;
+ *y=1-log(tan(latitude/2+(M_PI/4)))/M_PI;
+
+ *x/=pow(2,1-zoom);
+ *y/=pow(2,1-zoom);
+}
diff --git a/extras/statistics/update.sh b/extras/statistics/update.sh
new file mode 100755
index 0000000..31171f9
--- /dev/null
+++ b/extras/statistics/update.sh
@@ -0,0 +1,94 @@
+#!/bin/sh
+#
+# OSM data statistics shell script
+#
+# Part of the Routino routing software.
+#
+# This file Copyright 2008-2016 Andrew M. Bishop
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+set -e
+
+trap "rm binned.dat" 0
+
+# Database location and zoom - PARAMETERS THAT CAN BE EDITED
+
+database_dir="../../web/data"
+database_dir="/home/amb/www/local/cgi-temp/routino-data"
+zoom=13
+
+# Run the dumper
+
+./dumper --speed=32,48,64,80,96,112 --dir=$database_dir --zoom=$zoom > binned.dat
+
+# Generate the base map
+
+./create-basemap.pl
+
+# Generate the highway outputs
+
+./create-image.pl highway motorway      0 < binned.dat
+./create-image.pl highway trunk         1 < binned.dat
+./create-image.pl highway primary       2 < binned.dat
+./create-image.pl highway secondary     3 < binned.dat
+./create-image.pl highway tertiary      4 < binned.dat
+./create-image.pl highway unclassified  5 < binned.dat
+./create-image.pl highway residential   6 < binned.dat
+./create-image.pl highway service       7 < binned.dat
+./create-image.pl highway track         8 < binned.dat
+./create-image.pl highway cycleway      9 < binned.dat
+./create-image.pl highway path         10 < binned.dat
+./create-image.pl highway steps        11 < binned.dat
+./create-image.pl highway ferry        12 < binned.dat
+
+# Generate the transport outputs
+
+./create-image.pl transport foot        13 < binned.dat
+./create-image.pl transport horse       14 < binned.dat
+./create-image.pl transport bicycle     15 < binned.dat
+./create-image.pl transport wheelchair  16 < binned.dat
+./create-image.pl transport moped       17 < binned.dat
+./create-image.pl transport motorcycle  18 < binned.dat
+./create-image.pl transport motorcar    19 < binned.dat
+./create-image.pl transport goods       20 < binned.dat
+./create-image.pl transport HGV         21 < binned.dat
+./create-image.pl transport PSV         22 < binned.dat
+
+# Create the property outputs
+
+./create-image.pl property paved           23 < binned.dat
+./create-image.pl property multilane       24 < binned.dat
+./create-image.pl property bridge          25 < binned.dat
+./create-image.pl property tunnel          26 < binned.dat
+./create-image.pl property foot-route      27 < binned.dat
+./create-image.pl property bicycle-route   28 < binned.dat
+./create-image.pl property cycle-both-ways 29 < binned.dat
+./create-image.pl property oneway          30 < binned.dat
+
+# Generate the speed limit outputs
+
+./create-image.pl speed 20mph 31 < binned.dat
+./create-image.pl speed 30mph 32 < binned.dat
+./create-image.pl speed 40mph 33 < binned.dat
+./create-image.pl speed 50mph 34 < binned.dat
+./create-image.pl speed 60mph 35 < binned.dat
+./create-image.pl speed 70mph 36 < binned.dat
+
+# Tidy up and exit
+
+# This is handled by the trap at the top
+#
+#rm binned.dat
diff --git a/extras/tagmodifier/Makefile b/extras/tagmodifier/Makefile
index b61014a..8cad63b 100644
--- a/extras/tagmodifier/Makefile
+++ b/extras/tagmodifier/Makefile
@@ -24,8 +24,10 @@ include ../../Makefile.conf
 
 # Compilation targets
 
+DEPDIR=.deps
+
 C=$(wildcard *.c)
-D=$(wildcard .deps/*.d)
+D=$(wildcard $(DEPDIR)/*.d)
 
 ROUTINO_SRC=../../src
 
@@ -54,8 +56,8 @@ $(ROUTINO_SRC)/%.o :
 	cd $(ROUTINO_SRC) && $(MAKE) $(notdir $@)
 
 %.o : %.c
-	@[ -d .deps ] || mkdir .deps
-	$(CC) -c $(CFLAGS) -DSLIM=0 -I$(ROUTINO_SRC) $< -o $@ -MMD -MP -MF $(addprefix .deps/,$(addsuffix .d,$(basename $@)))
+	-@[ -d $(DEPDIR) ] || mkdir $(DEPDIR)
+	$(CC) -c $(CFLAGS) -DSLIM=0 -I$(ROUTINO_SRC) $< -o $@ -MMD -MP -MF $(addprefix $(DEPDIR)/,$(addsuffix .d,$(basename $@)))
 
 ########
 
@@ -72,7 +74,7 @@ clean:
 	rm -f *.o
 	rm -f $(EXE)
 	rm -f $(D)
-	rm -fr .deps
+	rm -fr $(DEPDIR)
 	rm -f core
 
 ########
diff --git a/src/Makefile b/src/Makefile
index 554eb10..8ef22d0 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -28,23 +28,35 @@ SUBDIRS=xml test
 
 # Compilation targets
 
+DEPDIR=.deps
+
 C=$(wildcard *.c)
-D=$(wildcard .deps/*.d)
+D=$(wildcard $(DEPDIR)/*.d)
 
 EXE=planetsplitter$(.EXE) planetsplitter-slim$(.EXE) router$(.EXE) router-slim$(.EXE) \
     filedumperx$(.EXE) filedumper$(.EXE) filedumper-slim$(.EXE) \
     router+lib$(.EXE) router+lib-slim$(.EXE)
 
-LIB=libroutino.so libroutino-slim.so
-
-ifeq ($(HOST),MINGW)
-LIB+=routino.dll routino-slim.dll
+ifneq ($(HOST),MINGW)
+LIB =libroutino.so               libroutino-slim.so
+LIB+=libroutino.so.$(SOVERSION)  libroutino-slim.so.$(SOVERSION)
+LIB+=libroutino.so.$(LIBVERSION) libroutino-slim.so.$(LIBVERSION)
+else
+LIB =routino.dll routino-slim.dll
 LIB+=routino.def routino-slim.def
 LIB+=routino.lib routino-slim.lib
 endif
 
 INC=routino.h
 
+ifneq ($(HOST),MINGW)
+LINK_LIB=libroutino.so
+LINK_SLIM_LIB=libroutino-slim.so
+else
+LINK_LIB=routino.dll
+LINK_SLIM_LIB=routino-slim.dll
+endif
+
 ########
 
 all: all-local
@@ -52,7 +64,11 @@ all: all-local
 	   ( cd $$dir && $(MAKE) $@ ); \
 	done
 
-all-local: $(EXE) $(LIB)
+all-local: all-exe all-lib
+
+all-exe : $(EXE)
+
+all-lib : $(LIB)
 
 ########
 
@@ -161,21 +177,21 @@ filedumper-slim$(.EXE) : $(FILEDUMPER_SLIM_OBJ)
 ########
 
 %.o : %.c
-	@[ -d .deps ] || mkdir .deps
-	$(CC) -c $(CFLAGS) -DSLIM=0 -DROUTINO_DATADIR=\"$(datadir)\" $< -o $@ -MMD -MP -MF $(addprefix .deps/,$(addsuffix .d,$(basename $@)))
+	-@[ -d $(DEPDIR) ] || mkdir $(DEPDIR)
+	$(CC) -c $(CFLAGS) -DSLIM=0 -DROUTINO_DATADIR=\"$(datadir)\" $< -o $@ -MMD -MP -MF $(addprefix $(DEPDIR)/,$(addsuffix .d,$(basename $@)))
 
 %-slim.o : %.c
-	@[ -d .deps ] || mkdir .deps
-	$(CC) -c $(CFLAGS) -DSLIM=1 -DROUTINO_DATADIR=\"$(datadir)\" $< -o $@ -MMD -MP -MF $(addprefix .deps/,$(addsuffix .d,$(basename $@)))
+	-@[ -d $(DEPDIR) ] || mkdir $(DEPDIR)
+	$(CC) -c $(CFLAGS) -DSLIM=1 -DROUTINO_DATADIR=\"$(datadir)\" $< -o $@ -MMD -MP -MF $(addprefix $(DEPDIR)/,$(addsuffix .d,$(basename $@)))
 
 ########
 
 ROUTER_LIB_OBJ=router+lib.o
 
-router+lib$(.EXE) : $(ROUTER_LIB_OBJ) libroutino.so
+router+lib$(.EXE) : $(ROUTER_LIB_OBJ) $(LINK_LIB)
 	$(LD) $^ -o $@ $(LDFLAGS) $(LDFLAGS_LDSO)
 
-router+lib-slim$(.EXE) : $(ROUTER_LIB_OBJ) libroutino-slim.so
+router+lib-slim$(.EXE) : $(ROUTER_LIB_OBJ) $(LINK_SLIM_LIB)
 	$(LD) $^ -o $@ $(LDFLAGS) $(LDFLAGS_LDSO)
 
 ########
@@ -190,11 +206,17 @@ ifeq ($(HOST),MINGW)
 LIBROUTINO_OBJ+=mman-win32.o
 endif
 
-libroutino.so : $(LIBROUTINO_OBJ)
-	$(LD) $^ -o $@ $(LDFLAGS) $(LDFLAGS_LIB)
+libroutino.so.$(LIBVERSION) : $(LIBROUTINO_OBJ)
+	$(LD) $^ -o $@ $(LDFLAGS) $(LDFLAGS_LIB) $(LDFLAGS_SONAME)
 
-routino.dll : libroutino.so
-	cp $< $@
+libroutino.so.$(SOVERSION) : libroutino.so.$(LIBVERSION)
+	ln -sf $< $@
+
+libroutino.so : libroutino.so.$(LIBVERSION)
+	ln -sf $< $@
+
+routino.dll : $(LIBROUTINO_OBJ)
+	$(LD) $^ -o $@ $(LDFLAGS) $(LDFLAGS_LIB)
 
 routino.def : routino-lib.o
 	dlltool -v --output-def $@ $<
@@ -214,11 +236,17 @@ ifeq ($(HOST),MINGW)
 LIBROUTINO_SLIM_OBJ+=mman-win32.o
 endif
 
-libroutino-slim.so : $(LIBROUTINO_SLIM_OBJ)
-	$(LD) $^ -o $@ $(LDFLAGS) $(LDFLAGS_LIB)
+libroutino-slim.so.$(LIBVERSION) : $(LIBROUTINO_SLIM_OBJ)
+	$(LD) $^ -o $@ $(LDFLAGS) $(LDFLAGS_LIB) $(LDFLAGS_SLIM_SONAME)
 
-routino-slim.dll : libroutino-slim.so
-	cp $< $@
+libroutino-slim.so.$(SOVERSION) : libroutino-slim.so.$(LIBVERSION)
+	ln -sf $< $@
+
+libroutino-slim.so : libroutino-slim.so.$(LIBVERSION)
+	ln -sf $< $@
+
+routino-slim.dll : $(LIBROUTINO_SLIM_OBJ)
+	$(LD) $^ -o $@ $(LDFLAGS) $(LDFLAGS_LIB)
 
 routino-slim.def : routino-slim-lib.o
 	dlltool -v --output-def $@ $<
@@ -229,12 +257,12 @@ routino-slim.lib : routino-slim.dll routino-slim.def
 ########
 
 %-lib.o : %.c
-	@[ -d .deps ] || mkdir .deps
-	$(CC) -c $(CFLAGS) $(CFLAGS_LIB) -DSLIM=0 -DLIBROUTINO $< -o $@ -MMD -MP -MF $(addprefix .deps/,$(addsuffix .d,$(basename $@)))
+	-@[ -d $(DEPDIR) ] || mkdir $(DEPDIR)
+	$(CC) -c $(CFLAGS) $(CFLAGS_LIB) -DSLIM=0 -DLIBROUTINO $< -o $@ -MMD -MP -MF $(addprefix $(DEPDIR)/,$(addsuffix .d,$(basename $@)))
 
 %-slim-lib.o : %.c
-	@[ -d .deps ] || mkdir .deps
-	$(CC) -c $(CFLAGS) $(CFLAGS_LIB) -DSLIM=1 -DLIBROUTINO $< -o $@ -MMD -MP -MF $(addprefix .deps/,$(addsuffix .d,$(basename $@)))
+	-@[ -d $(DEPDIR) ] || mkdir $(DEPDIR)
+	$(CC) -c $(CFLAGS) $(CFLAGS_LIB) -DSLIM=1 -DLIBROUTINO $< -o $@ -MMD -MP -MF $(addprefix $(DEPDIR)/,$(addsuffix .d,$(basename $@)))
 
 ########
 
@@ -271,7 +299,7 @@ install-local: all-local
 	@for file in $(LIB); do \
 	    if [ -f $$file ]; then \
 	       echo cp $$file $(DESTDIR)$(libdir) ;\
-	       cp -f $$file $(DESTDIR)$(libdir) ;\
+	       cp -df $$file $(DESTDIR)$(libdir) ;\
 	    fi ;\
 	 done
 
@@ -288,7 +316,7 @@ clean-local:
 	rm -f $(EXE)
 	rm -f $(LIB)
 	rm -f $(D)
-	rm -fr .deps
+	rm -fr $(DEPDIR)
 	rm -f core
 	rm -f *.gcda *.gcno *.gcov gmon.out
 
diff --git a/src/optimiser.c b/src/optimiser.c
index b64702e..3b5d253 100644
--- a/src/optimiser.c
+++ b/src/optimiser.c
@@ -3,7 +3,7 @@
 
  Part of the Routino routing software.
  ******************/ /******************
- This file Copyright 2008-2015 Andrew M. Bishop
+ This file Copyright 2008-2016 Andrew M. Bishop
 
  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU Affero General Public License as published by
@@ -64,12 +64,17 @@ extern int option_quickest;
 
 static Results *FindNormalRoute(Nodes *nodes,Segments *segments,Ways *ways,Relations *relations,Profile *profile,index_t start_node,index_t prev_segment,index_t finish_node);
 static Results *FindMiddleRoute(Nodes *supernodes,Segments *supersegments,Ways *superways,Relations *relations,Profile *profile,Results *begin,Results *end);
-static index_t FindSuperSegment(Nodes *nodes,Segments *segments,Ways *ways,Relations *relations,Profile *profile,index_t finish_node,index_t finish_segment);
+static index_t  FindSuperSegment(Nodes *nodes,Segments *segments,Ways *ways,Relations *relations,Profile *profile,index_t finish_node,index_t finish_segment);
 static Results *FindSuperRoute(Nodes *nodes,Segments *segments,Ways *ways,Relations *relations,Profile *profile,index_t start_node,index_t finish_node);
 static Results *FindStartRoutes(Nodes *nodes,Segments *segments,Ways *ways,Relations *relations,Profile *profile,index_t start_node,index_t prev_segment,index_t finish_node);
 static Results *FindFinishRoutes(Nodes *nodes,Segments *segments,Ways *ways,Relations *relations,Profile *profile,index_t finish_node);
 static Results *CombineRoutes(Nodes *nodes,Segments *segments,Ways *ways,Relations *relations,Profile *profile,Results *begin,Results *middle,Results *end);
-static void FixForwardRoute(Results *results,Result *finish_result);
+
+static void     FixForwardRoute(Results *results,Result *finish_result);
+
+#if DEBUG
+static void print_debug_route(Nodes *nodes,Segments *segments,Results *results,Result *first,int indent,int direction);
+#endif
 
 
 /*++++++++++++++++++++++++++++++++++++++
@@ -243,16 +248,9 @@ Results *CalculateRoute(Nodes *nodes,Segments *segments,Ways *ways,Relations *re
  complete->finish_waypoint=finish_waypoint;
 
 #if DEBUG
- Result *r=FindResult(complete,complete->start_node,complete->prev_segment);
-
  printf("The final route is:\n");
 
- while(r)
-   {
-    printf("  node=%"Pindex_t" segment=%"Pindex_t" score=%f\n",r->node,r->segment,r->score);
-
-    r=r->next;
-   }
+ print_debug_route(nodes,segments,complete,NULL,2,+1);
 #endif
 
  return(complete);
@@ -285,9 +283,9 @@ static Results *FindNormalRoute(Nodes *nodes,Segments *segments,Ways *ways,Relat
 {
  Results *results;
  Queue   *queue;
- score_t finish_score;
+ score_t total_score;
  double  finish_lat,finish_lon;
- Result  *finish_result;
+ Result  *start_result,*finish_result;
  Result  *result1,*result2;
  int     force_uturn=0;
 
@@ -297,7 +295,7 @@ static Results *FindNormalRoute(Nodes *nodes,Segments *segments,Ways *ways,Relat
 
  /* Set up the finish conditions */
 
- finish_score=INF_SCORE;
+ total_score=INF_SCORE;
  finish_result=NULL;
 
  if(IsFakeNode(finish_node))
@@ -310,12 +308,9 @@ static Results *FindNormalRoute(Nodes *nodes,Segments *segments,Ways *ways,Relat
  results=NewResultsList(8);
  queue=NewQueueList(8);
 
- results->start_node=start_node;
- results->prev_segment=prev_segment;
+ start_result=InsertResult(results,start_node,prev_segment);
 
- result1=InsertResult(results,results->start_node,results->prev_segment);
-
- InsertInQueue(queue,result1,0);
+ InsertInQueue(queue,start_result,0);
 
  /* Check for barrier at start waypoint - must perform U-turn */
 
@@ -332,12 +327,12 @@ static Results *FindNormalRoute(Nodes *nodes,Segments *segments,Ways *ways,Relat
  while((result1=PopFromQueue(queue)))
    {
     Node *node1p=NULL;
-    Segment *segmentp;
+    Segment *segment2p;
     index_t node1,seg1,seg1r;
     index_t turnrelation=NO_RELATION;
 
     /* score must be better than current best score */
-    if(result1->score>=finish_score)
+    if(result1->score>=total_score)
        continue;
 
     node1=result1->node;
@@ -358,49 +353,49 @@ static Results *FindNormalRoute(Nodes *nodes,Segments *segments,Ways *ways,Relat
     /* Loop across all segments */
 
     if(IsFakeNode(node1))
-       segmentp=FirstFakeSegment(node1);
+       segment2p=FirstFakeSegment(node1);
     else
-       segmentp=FirstSegment(segments,node1p,1);
+       segment2p=FirstSegment(segments,node1p,1);
 
-    while(segmentp)
+    while(segment2p)
       {
        Node *node2p=NULL;
-       Way *wayp;
+       Way *way2p;
        index_t node2,seg2,seg2r;
        score_t segment_pref,segment_score,cumulative_score;
        int i;
 
-       node2=OtherNode(segmentp,node1); /* need this here because we use node2 at the end of the loop */
+       node2=OtherNode(segment2p,node1); /* need this here because we use node2 at the end of the loop */
 
        /* must be a normal segment */
-       if(!IsNormalSegment(segmentp))
+       if(!IsNormalSegment(segment2p))
           goto endloop;
 
        /* must obey one-way restrictions (unless profile allows) */
-       if(profile->oneway && IsOnewayTo(segmentp,node1))
+       if(profile->oneway && IsOnewayTo(segment2p,node1))
          {
           if(profile->allow!=Transports_Bicycle)
              goto endloop;
 
-          wayp=LookupWay(ways,segmentp->way,1);
+          way2p=LookupWay(ways,segment2p->way,1);
 
-          if(!(wayp->type&Highway_CycleBothWays))
+          if(!(way2p->type&Highway_CycleBothWays))
              goto endloop;
          }
 
        if(IsFakeNode(node1) || IsFakeNode(node2))
          {
-          seg2 =IndexFakeSegment(segmentp);
+          seg2 =IndexFakeSegment(segment2p);
           seg2r=IndexRealSegment(seg2);
          }
        else
          {
-          seg2 =IndexSegment(segments,segmentp);
+          seg2 =IndexSegment(segments,segment2p);
           seg2r=seg2;
          }
 
        /* must perform U-turn in special cases */
-       if(force_uturn && node1==results->start_node)
+       if(force_uturn && node1==start_node)
          {
           if(seg2r!=result1->segment)
              goto endloop;
@@ -421,23 +416,23 @@ static Results *FindNormalRoute(Nodes *nodes,Segments *segments,Ways *ways,Relat
        if(node2!=finish_node && node2p && IsSuperNode(node2p))
           goto endloop;
 
-       wayp=LookupWay(ways,segmentp->way,1);
+       way2p=LookupWay(ways,segment2p->way,1);
 
        /* mode of transport must be allowed on the highway */
-       if(!(wayp->allow&profile->allow))
+       if(!(way2p->allow&profile->allow))
           goto endloop;
 
        /* must obey weight restriction (if exists) */
-       if(wayp->weight && wayp->weight<profile->weight)
+       if(way2p->weight && way2p->weight<profile->weight)
           goto endloop;
 
        /* must obey height/width/length restriction (if exist) */
-       if((wayp->height && wayp->height<profile->height) ||
-          (wayp->width  && wayp->width <profile->width ) ||
-          (wayp->length && wayp->length<profile->length))
+       if((way2p->height && way2p->height<profile->height) ||
+          (way2p->width  && way2p->width <profile->width ) ||
+          (way2p->length && way2p->length<profile->length))
           goto endloop;
 
-       segment_pref=profile->highway[HIGHWAY(wayp->type)];
+       segment_pref=profile->highway[HIGHWAY(way2p->type)];
 
        /* highway preferences must allow this highway */
        if(segment_pref==0)
@@ -446,7 +441,7 @@ static Results *FindNormalRoute(Nodes *nodes,Segments *segments,Ways *ways,Relat
        for(i=1;i<Property_Count;i++)
           if(ways->file.props & PROPERTIES(i))
             {
-             if(wayp->props & PROPERTIES(i))
+             if(way2p->props & PROPERTIES(i))
                 segment_pref*=profile->props_yes[i];
              else
                 segment_pref*=profile->props_no[i];
@@ -462,14 +457,14 @@ static Results *FindNormalRoute(Nodes *nodes,Segments *segments,Ways *ways,Relat
 
        /* calculate the score for the segment and cumulative */
        if(option_quickest==0)
-          segment_score=(score_t)DISTANCE(segmentp->distance)/segment_pref;
+          segment_score=(score_t)DISTANCE(segment2p->distance)/segment_pref;
        else
-          segment_score=(score_t)Duration(segmentp,wayp,profile)/segment_pref;
+          segment_score=(score_t)Duration(segment2p,way2p,profile)/segment_pref;
 
        cumulative_score=result1->score+segment_score;
 
        /* score must be better than current best score */
-       if(cumulative_score>=finish_score)
+       if(cumulative_score>=total_score)
           goto endloop;
 
        /* find whether the node/segment combination already exists */
@@ -492,11 +487,8 @@ static Results *FindNormalRoute(Nodes *nodes,Segments *segments,Ways *ways,Relat
 
        if(node2==finish_node)
          {
-          finish_score=cumulative_score;
+          total_score=cumulative_score;
           finish_result=result2;
-
-          results->finish_node=node2;
-          results->last_segment=seg2;
          }
        else
           InsertInQueue(queue,result2,result2->score);
@@ -504,15 +496,15 @@ static Results *FindNormalRoute(Nodes *nodes,Segments *segments,Ways *ways,Relat
       endloop:
 
        if(IsFakeNode(node1))
-          segmentp=NextFakeSegment(segmentp,node1);
+          segment2p=NextFakeSegment(segment2p,node1);
        else if(IsFakeNode(node2))
-          segmentp=NULL; /* cannot call NextSegment() with a fake segment */
+          segment2p=NULL; /* cannot call NextSegment() with a fake segment */
        else
          {
-          segmentp=NextSegment(segments,segmentp,node1);
+          segment2p=NextSegment(segments,segment2p,node1);
 
-          if(!segmentp && IsFakeNode(finish_node))
-             segmentp=ExtraFakeSegment(node1,finish_node);
+          if(!segment2p && IsFakeNode(finish_node))
+             segment2p=ExtraFakeSegment(node1,finish_node);
          }
       }
    }
@@ -531,22 +523,20 @@ static Results *FindNormalRoute(Nodes *nodes,Segments *segments,Ways *ways,Relat
     return(NULL);
    }
 
+ /* Turn the route round and fill in the start and finish information */
+
  FixForwardRoute(results,finish_result);
 
-#if DEBUG
- Result *r=FindResult(results,results->start_node,results->prev_segment);
+ results->start_node  =start_result->node;
+ results->prev_segment=start_result->segment;
 
- printf("      -------- normal route (between super-nodes)\n");
+ results->finish_node =finish_result->node;
+ results->last_segment=finish_result->segment;
 
- while(r)
-   {
-    printf("      node=%"Pindex_t" segment=%"Pindex_t" score=%f%s%s%s\n",r->node,r->segment,r->score,
-                                                                         (IsSuperNode(LookupNode(nodes,r->node,1))?" (super)":""),
-                                                                         (r->node==results->start_node&&r->segment==results->prev_segment?" (start)":""),
-                                                                         (r->node==results->finish_node?" (finish)":""));
+#if DEBUG
+ printf("      -------- normal route (between super-nodes)\n");
 
-    r=r->next;
-   }
+ print_debug_route(nodes,segments,results,NULL,6,+1);
 #endif
 
  return(results);
@@ -576,11 +566,12 @@ static Results *FindNormalRoute(Nodes *nodes,Segments *segments,Ways *ways,Relat
 static Results *FindMiddleRoute(Nodes *nodes,Segments *segments,Ways *ways,Relations *relations,Profile *profile,Results *begin,Results *end)
 {
  Results *results;
- Queue   *queue;
- Result  *finish_result;
- score_t finish_score;
+ Queue   *fwd_queue,*rev_queue;
+ Result  *start_result,*finish_result;
+ score_t total_score;
+ double  start_lat,start_lon;
  double  finish_lat,finish_lon;
- Result  *result1,*result2,*result3,*result4;
+ Result  *result1,*result2;
  int     force_uturn=0;
 #ifdef LIBROUTINO
  int     loopcount=0;
@@ -597,274 +588,514 @@ static Results *FindMiddleRoute(Nodes *nodes,Segments *segments,Ways *ways,Relat
 
  /* Set up the finish conditions */
 
- finish_score=INF_SCORE;
+ total_score=INF_SCORE;
+ start_result=NULL;
  finish_result=NULL;
 
+ if(IsFakeNode(begin->start_node))
+    GetFakeLatLong(begin->start_node,&start_lat,&start_lon);
+ else
+    GetLatLong(nodes,begin->start_node,NULL,&start_lat,&start_lon);
+
  if(IsFakeNode(end->finish_node))
     GetFakeLatLong(end->finish_node,&finish_lat,&finish_lon);
  else
     GetLatLong(nodes,end->finish_node,NULL,&finish_lat,&finish_lon);
 
- /* Create the list of results and insert the first node into the queue */
+ /* Create the list of results and queues */
 
  results=NewResultsList(20);
- queue=NewQueueList(12);
+ fwd_queue=NewQueueList(12);
+ rev_queue=NewQueueList(12);
 
- results->start_node=begin->start_node;
- results->prev_segment=begin->prev_segment;
+ /* Insert the finish points of the beginning part of the path into the results,
+    translating the segments into super-segments. */
 
- if(begin->number==1 && begin->prev_segment!=NO_SEGMENT)
+ if(begin->number==1)
    {
-    index_t superseg=FindSuperSegment(nodes,segments,ways,relations,profile,begin->start_node,begin->prev_segment);
+    index_t superseg=NO_SEGMENT;
 
-    results->prev_segment=superseg;
-   }
+    if(begin->prev_segment!=NO_SEGMENT)
+       superseg=FindSuperSegment(nodes,segments,ways,relations,profile,begin->start_node,begin->prev_segment);
 
- result1=InsertResult(results,results->start_node,results->prev_segment);
+    start_result=InsertResult(results,begin->start_node,superseg);
 
- /* Insert the finish points of the beginning part of the path into the queue,
-    translating the segments into super-segments. */
+    InsertInQueue(fwd_queue,start_result,0);
 
- result3=FirstResult(begin);
+    /* Check for barrier at start waypoint - must perform U-turn */
 
- while(result3)
-   {
-    if((results->start_node!=result3->node || results->prev_segment!=result3->segment) &&
-       !IsFakeNode(result3->node) && IsSuperNode(LookupNode(nodes,result3->node,3)))
+    if(superseg!=NO_SEGMENT)
       {
-       Result *result5=result1;
-       index_t superseg=FindSuperSegment(nodes,segments,ways,relations,profile,result3->node,result3->segment);
+       Node *startp=LookupNode(nodes,begin->start_node,1);
 
-       if(superseg!=result3->segment)
-         {
-          result5=InsertResult(results,result3->node,result3->segment);
+       if(!(startp->allow&profile->allow))
+          force_uturn=1;
+      }
+   }
+ else
+   {
+    Result *begin_result=FirstResult(begin);
+    Result *end_result;
 
-          result5->score=result3->score;
+    while((begin_result=NextResult(begin,begin_result)))
+      {
+       if(!IsFakeNode(begin_result->node) && IsSuperNode(LookupNode(nodes,begin_result->node,3)))
+         {
+          index_t superseg=FindSuperSegment(nodes,segments,ways,relations,profile,begin_result->node,begin_result->segment);
 
-          result5->prev=result1;
-         }
+          if(superseg!=begin_result->segment)
+            {
+             result1=InsertResult(results,begin_result->node,begin_result->segment);
 
-       if(!FindResult(results,result3->node,superseg))
-         {
-          result2=InsertResult(results,result3->node,superseg);
-          result2->prev=result5;
+             result1->score=begin_result->score;
+            }
+          else
+             result1=NO_RESULT;
 
-          result2->score=result3->score;
+          result2=FindResult(results,begin_result->node,superseg);
 
-          InsertInQueue(queue,result2,result3->score);
+          if(!result2) /* New end node/super-segment pair */
+            {
+             result2=InsertResult(results,begin_result->node,superseg);
+             result2->prev=result1;
+             result2->score=begin_result->score;
+            }
+          else if(begin_result->score<result2->score) /* New end node/super-segment pair is better */
+            {
+             result2->prev=result1;
+             result2->score=begin_result->score;
+            }
+          else
+             continue;
 
-          if((result4=FindResult(end,result2->node,result2->segment)))
+          if((end_result=FindResult(end,result2->node,result2->segment)))
             {
-             if((result2->score+result4->score)<finish_score)
+             if((result2->score+end_result->score)<total_score)
                {
-                finish_score=result2->score+result4->score;
-                finish_result=result2;
+                total_score=result2->score+end_result->score;
+                start_result=finish_result=result2;
                }
             }
          }
       }
 
-    result3=NextResult(begin,result3);
-   }
+    /* Insert the start points of the beginning part of the path into the queue */
 
- if(begin->number==1)
-    InsertInQueue(queue,result1,0);
+    if(!finish_result)
+      {
+       Result *result=FirstResult(results);
 
- /* Check for barrier at start waypoint - must perform U-turn */
+       while(result)
+         {
+          if(result->prev)
+             InsertInQueue(fwd_queue,result,result->score);
 
- if(begin->number==1 && results->prev_segment!=NO_SEGMENT)
-   {
-    Node *startp=LookupNode(nodes,result1->node,1);
+          result=NextResult(results,result);
+         }
+      }
 
-    if(!(startp->allow&profile->allow))
-       force_uturn=1;
-   }
+    /* Insert the start points of the end part of the path into the queue */
 
- /* Loop across all nodes in the queue */
+    if(!finish_result)
+      {
+       end_result=FirstResult(end);
 
- while((result1=PopFromQueue(queue)))
-   {
-    Node *node1p;
-    Segment *segmentp;
-    index_t node1,seg1;
-    index_t turnrelation=NO_RELATION;
+       while(end_result)
+         {
+          if(!IsFakeNode(end_result->node) && IsSuperNode(LookupNode(nodes,end_result->node,3)))
+            {
+             result1=InsertResult(results,end_result->node,end_result->segment);
 
-    /* score must be better than current best score */
-    if(result1->score>=finish_score)
-       continue;
+             result1->next=NO_RESULT;
+             result1->score=end_result->score;
 
-    node1=result1->node;
-    seg1=result1->segment;
+             InsertInQueue(rev_queue,result1,0);
+            }
 
-    node1p=LookupNode(nodes,node1,1); /* node1 cannot be a fake node (must be a super-node) */
+          end_result=NextResult(end,end_result);
+         }
+      }
+   }
 
-    /* lookup if a turn restriction applies */
-    if(profile->turns && IsTurnRestrictedNode(node1p)) /* node1 cannot be a fake node (must be a super-node) */
-       turnrelation=FindFirstTurnRelation2(relations,node1,seg1);
 
-    /* Loop across all segments */
+ /* Loop across all nodes in the two queues, alternating between them */
 
-    segmentp=FirstSegment(segments,node1p,1); /* node1 cannot be a fake node (must be a super-node) */
+ while(1)
+   {
+    /* Forward queue */
 
-    while(segmentp)
+    if((result1=PopFromQueue(fwd_queue)))
       {
-       Node *node2p;
-       Way *wayp;
-       index_t node2,seg2;
-       score_t segment_pref,segment_score,cumulative_score;
-       int i;
+       Node *node1p;
+       Segment *segment2p;
+       index_t node1,seg1;
+       index_t turnrelation=NO_RELATION;
 
-       /* must be a super segment */
-       if(!IsSuperSegment(segmentp))
-          goto endloop;
+       /* score must be better than current best score */
+       if(result1->score>=total_score)
+          continue;
 
-       /* must obey one-way restrictions (unless profile allows) */
-       if(profile->oneway && IsOnewayTo(segmentp,node1))
-         {
-          if(profile->allow!=Transports_Bicycle)
-             goto endloop;
+       node1=result1->node;
+       seg1=result1->segment;
 
-          wayp=LookupWay(ways,segmentp->way,1);
+       node1p=LookupNode(nodes,node1,1); /* node1 cannot be a fake node (must be a super-node) */
 
-          if(!(wayp->type&Highway_CycleBothWays))
-             goto endloop;
-         }
+       /* lookup if a turn restriction applies */
+       if(profile->turns && IsTurnRestrictedNode(node1p)) /* node1 cannot be a fake node (must be a super-node) */
+          turnrelation=FindFirstTurnRelation2(relations,node1,seg1);
 
-       seg2=IndexSegment(segments,segmentp); /* segment cannot be a fake segment (must be a super-segment) */
+       /* Loop across all segments */
 
-       /* must perform U-turn in special cases */
-       if(force_uturn && node1==results->start_node)
+       segment2p=FirstSegment(segments,node1p,1); /* node1 cannot be a fake node (must be a super-node) */
+
+       while(segment2p)
          {
-          if(seg2!=result1->segment)
-             goto endloop;
-         }
-       else
-          /* must not perform U-turn */
-          if(seg1==seg2) /* No fake segments, applies to all profiles */
-             goto endloop;
+          Node *node2p;
+          Way *way2p;
+          index_t node2,seg2;
+          score_t segment_pref,segment_score,cumulative_score,potential_score;
+          double lat,lon;
+          distance_t direct;
+          int i;
 
-       /* must obey turn relations */
-       if(turnrelation!=NO_RELATION && !IsTurnAllowed(relations,turnrelation,node1,seg1,seg2,profile->allow))
-          goto endloop;
+          /* must be a super segment */
+          if(!IsSuperSegment(segment2p))
+             goto endloop_fwd;
 
-       wayp=LookupWay(ways,segmentp->way,1);
+          /* must obey one-way restrictions (unless profile allows) */
+          if(profile->oneway && IsOnewayTo(segment2p,node1))
+            {
+             if(profile->allow!=Transports_Bicycle)
+                goto endloop_fwd;
 
-       /* mode of transport must be allowed on the highway */
-       if(!(wayp->allow&profile->allow))
-          goto endloop;
+             way2p=LookupWay(ways,segment2p->way,1);
 
-       /* must obey weight restriction (if exists) */
-       if(wayp->weight && wayp->weight<profile->weight)
-          goto endloop;
+             if(!(way2p->type&Highway_CycleBothWays))
+                goto endloop_fwd;
+            }
 
-       /* must obey height/width/length restriction (if exist) */
-       if((wayp->height && wayp->height<profile->height) ||
-          (wayp->width  && wayp->width <profile->width ) ||
-          (wayp->length && wayp->length<profile->length))
-          goto endloop;
+          seg2=IndexSegment(segments,segment2p); /* segment cannot be a fake segment (must be a super-segment) */
 
-       segment_pref=profile->highway[HIGHWAY(wayp->type)];
+          /* must perform U-turn in special cases */
+          if(force_uturn && node1==begin->start_node)
+            {
+             if(seg2!=result1->segment)
+                goto endloop_fwd;
+            }
+          else
+             /* must not perform U-turn */
+             if(seg1==seg2) /* No fake segments, applies to all profiles */
+                goto endloop_fwd;
 
-       /* highway preferences must allow this highway */
-       if(segment_pref==0)
-          goto endloop;
+          /* must obey turn relations */
+          if(turnrelation!=NO_RELATION && !IsTurnAllowed(relations,turnrelation,node1,seg1,seg2,profile->allow))
+             goto endloop_fwd;
 
-       for(i=1;i<Property_Count;i++)
-          if(ways->file.props & PROPERTIES(i))
+          way2p=LookupWay(ways,segment2p->way,1);
+
+          /* mode of transport must be allowed on the highway */
+          if(!(way2p->allow&profile->allow))
+             goto endloop_fwd;
+
+          /* must obey weight restriction (if exists) */
+          if(way2p->weight && way2p->weight<profile->weight)
+             goto endloop_fwd;
+
+          /* must obey height/width/length restriction (if exist) */
+          if((way2p->height && way2p->height<profile->height) ||
+             (way2p->width  && way2p->width <profile->width ) ||
+             (way2p->length && way2p->length<profile->length))
+             goto endloop_fwd;
+
+          segment_pref=profile->highway[HIGHWAY(way2p->type)];
+
+          /* highway preferences must allow this highway */
+          if(segment_pref==0)
+             goto endloop_fwd;
+
+          for(i=1;i<Property_Count;i++)
+             if(ways->file.props & PROPERTIES(i))
+               {
+                if(way2p->props & PROPERTIES(i))
+                   segment_pref*=profile->props_yes[i];
+                else
+                   segment_pref*=profile->props_no[i];
+               }
+
+          /* profile preferences must allow this highway */
+          if(segment_pref==0)
+             goto endloop_fwd;
+
+          node2=OtherNode(segment2p,node1);
+
+          node2p=LookupNode(nodes,node2,2); /* node2 cannot be a fake node (must be a super-node) */
+
+          /* mode of transport must be allowed through node2 unless it is the final node */
+          if(node2!=end->finish_node && !(node2p->allow&profile->allow))
+             goto endloop_fwd;
+
+          /* calculate the score for the segment and cumulative */
+          if(option_quickest==0)
+             segment_score=(score_t)DISTANCE(segment2p->distance)/segment_pref;
+          else
+             segment_score=(score_t)Duration(segment2p,way2p,profile)/segment_pref;
+
+          cumulative_score=result1->score+segment_score;
+
+          /* score must be better than current best score */
+          if(cumulative_score>=total_score)
+             goto endloop_fwd;
+
+          /* find whether the node/segment combination already exists */
+          result2=FindResult(results,node2,seg2);
+
+          if(result2 && result2->next)
             {
-             if(wayp->props & PROPERTIES(i))
-                segment_pref*=profile->props_yes[i];
-             else
-                segment_pref*=profile->props_no[i];
+             if((cumulative_score+result2->score)<total_score && !result2->prev)
+               {
+                result2->prev=result1;
+                total_score=cumulative_score+result2->score;
+                finish_result=start_result=result2;
+               }
+
+             goto endloop_fwd;
             }
 
-       /* profile preferences must allow this highway */
-       if(segment_pref==0)
-          goto endloop;
+          if(!result2) /* New end node/segment pair */
+            {
+             result2=InsertResult(results,node2,seg2);
+             result2->prev=result1;
+             result2->score=cumulative_score;
+            }
+          else if(cumulative_score<result2->score) /* New end node/segment pair is better */
+            {
+             result2->prev=result1;
+             result2->score=cumulative_score;
+            }
+          else
+             goto endloop_fwd;
 
-       node2=OtherNode(segmentp,node1);
+          /* Insert a new node into the queue */
 
-       node2p=LookupNode(nodes,node2,2); /* node2 cannot be a fake node (must be a super-node) */
+          GetLatLong(nodes,node2,node2p,&lat,&lon); /* node2 cannot be a fake node (must be a super-node) */
 
-       /* mode of transport must be allowed through node2 unless it is the final node */
-       if(node2!=end->finish_node && !(node2p->allow&profile->allow))
-          goto endloop;
+          direct=Distance(lat,lon,finish_lat,finish_lon);
 
-       /* calculate the score for the segment and cumulative */
-       if(option_quickest==0)
-          segment_score=(score_t)DISTANCE(segmentp->distance)/segment_pref;
-       else
-          segment_score=(score_t)Duration(segmentp,wayp,profile)/segment_pref;
+          if(option_quickest==0)
+             potential_score=result2->score+(score_t)direct/profile->max_pref;
+          else
+             potential_score=result2->score+(score_t)distance_speed_to_duration(direct,profile->max_speed)/profile->max_pref;
 
-       cumulative_score=result1->score+segment_score;
+          if(potential_score<total_score)
+             InsertInQueue(fwd_queue,result2,potential_score);
 
-       /* score must be better than current best score */
-       if(cumulative_score>=finish_score)
-          goto endloop;
+         endloop_fwd:
 
-       /* find whether the node/segment combination already exists */
-       result2=FindResult(results,node2,seg2);
-
-       if(!result2) /* New end node/segment pair */
-         {
-          result2=InsertResult(results,node2,seg2);
-          result2->prev=result1;
-          result2->score=cumulative_score;
+          segment2p=NextSegment(segments,segment2p,node1); /* node1 cannot be a fake node (must be a super-node) */
          }
-       else if(cumulative_score<result2->score) /* New end node/segment pair is better */
-         {
-          result2->prev=result1;
-          result2->score=cumulative_score;
-         }
-       else
-          goto endloop;
 
-       if((result3=FindResult(end,node2,seg2)))
-         {
-          if((result2->score+result3->score)<finish_score)
+#ifdef LIBROUTINO
+       if(!(++loopcount%100000))
+          if(progress_func && !progress_func(progress_value))
             {
-             finish_score=result2->score+result3->score;
-             finish_result=result2;
+             progress_abort=1;
+             break;
+            }
+#endif
+      }
+    else
+       break;
+
+    /* Reverse queue */
+
+    if(!finish_result && (result1=PopFromQueue(rev_queue)))
+      {
+       Node *node1p;
+       Segment *segment1p,*segment2p;
+       Way *way1p;
+       index_t real_node1,node1,seg1;
+       score_t segment1_pref,segment1_score=0;
+       int i;
+
+       /* score must be better than current best score */
+       if(result1->score>=total_score)
+          continue;
 
-             results->finish_node=node2;
-             results->last_segment=seg2;
+       real_node1=result1->node;
+       seg1=result1->segment;
+
+       segment1p=LookupSegment(segments,seg1,1);
+
+       node1=OtherNode(segment1p,real_node1);
+
+       node1p=LookupNode(nodes,node1,1);
+
+       /* mode of transport must be allowed through node1 */
+       if(!(node1p->allow&profile->allow))
+          continue;
+
+       way1p=LookupWay(ways,segment1p->way,1);
+
+       segment1_pref=profile->highway[HIGHWAY(way1p->type)];
+
+       for(i=1;i<Property_Count;i++)
+          if(ways->file.props & PROPERTIES(i))
+            {
+             if(way1p->props & PROPERTIES(i))
+                segment1_pref*=profile->props_yes[i];
+             else
+                segment1_pref*=profile->props_no[i];
             }
-         }
+
+       /* calculate the score for the segment */
+       if(option_quickest==0)
+          segment1_score=(score_t)DISTANCE(segment1p->distance)/segment1_pref;
        else
+          segment1_score=(score_t)Duration(segment1p,way1p,profile)/segment1_pref;
+
+       /* Loop across all segments */
+
+       segment2p=FirstSegment(segments,node1p,1); /* node1 cannot be a fake node (must be a super-node) */
+
+       while(segment2p)
          {
+          Node *node2p;
+          Way *way2p;
+          index_t node2,seg2;
+          score_t segment_pref,cumulative_score,potential_score;
           double lat,lon;
           distance_t direct;
-          score_t potential_score;
+
+          seg2=IndexSegment(segments,segment2p); /* segment cannot be a fake segment (must be a super-segment) */
+
+          /* must not perform U-turn */
+          if(seg1==seg2) /* No fake segments, applies to all profiles */
+             goto endloop_rev;
+
+          /* find whether the node/segment combination already exists */
+          result2=FindResult(results,node1,seg2);
+
+          /* must be a super segment */
+          if(!IsSuperSegment(segment2p) && !(result2 && result2->prev))
+             goto endloop_rev;
+
+          /* must obey turn relations */
+          if(profile->turns && IsTurnRestrictedNode(node1p)) /* node1 cannot be a fake node (must be a super-node) */
+            {
+             index_t turnrelation2=FindFirstTurnRelation2(relations,node1,seg2);
+
+             if(turnrelation2!=NO_RELATION && !IsTurnAllowed(relations,turnrelation2,node1,seg2,seg1,profile->allow))
+                goto endloop_rev;
+            }
+
+          if(result2 && result2->prev)
+             goto endloop_rev;
+
+          /* must obey one-way restrictions (unless profile allows) */
+          if(profile->oneway && IsOnewayFrom(segment2p,node1)) /* working backwards => disallow oneway *from* node1 */
+            {
+             if(profile->allow!=Transports_Bicycle)
+                goto endloop_rev;
+
+             way2p=LookupWay(ways,segment2p->way,1);
+
+             if(!(way2p->type&Highway_CycleBothWays))
+                goto endloop_rev;
+            }
+
+          way2p=LookupWay(ways,segment2p->way,1);
+
+          /* mode of transport must be allowed on the highway */
+          if(!(way2p->allow&profile->allow))
+             goto endloop_rev;
+
+          /* must obey weight restriction (if exists) */
+          if(way2p->weight && way2p->weight<profile->weight)
+             goto endloop_rev;
+
+          /* must obey height/width/length restriction (if exist) */
+          if((way2p->height && way2p->height<profile->height) ||
+             (way2p->width  && way2p->width <profile->width ) ||
+             (way2p->length && way2p->length<profile->length))
+             goto endloop_rev;
+
+          segment_pref=profile->highway[HIGHWAY(way2p->type)];
+
+          /* highway preferences must allow this highway */
+          if(segment_pref==0)
+             goto endloop_rev;
+
+          for(i=1;i<Property_Count;i++)
+             if(ways->file.props & PROPERTIES(i))
+               {
+                if(way2p->props & PROPERTIES(i))
+                   segment_pref*=profile->props_yes[i];
+                else
+                   segment_pref*=profile->props_no[i];
+               }
+
+          /* profile preferences must allow this highway */
+          if(segment_pref==0)
+             goto endloop_rev;
+
+          node2=OtherNode(segment2p,node1);
+
+          node2p=LookupNode(nodes,node2,2); /* node2 cannot be a fake node (must be a super-node) */
+
+          cumulative_score=result1->score+segment1_score;
+
+          /* score must be better than current best score */
+          if(cumulative_score>=total_score)
+             goto endloop_rev;
+
+          if(!result2) /* New end node/segment pair */
+            {
+             result2=InsertResult(results,node1,seg2); /* adding in reverse => node1,seg2 */
+             result2->next=result1;   /* working backwards */
+             result2->score=cumulative_score;
+            }
+          else if(cumulative_score<result2->score) /* New end node/segment pair is better */
+            {
+             result2->next=result1; /* working backwards */
+             result2->score=cumulative_score;
+            }
+          else
+             goto endloop_rev;
+
+          /* Insert a new node into the queue */
 
           GetLatLong(nodes,node2,node2p,&lat,&lon); /* node2 cannot be a fake node (must be a super-node) */
 
-          direct=Distance(lat,lon,finish_lat,finish_lon);
+          direct=Distance(lat,lon,start_lat,start_lon);
 
           if(option_quickest==0)
              potential_score=result2->score+(score_t)direct/profile->max_pref;
           else
              potential_score=result2->score+(score_t)distance_speed_to_duration(direct,profile->max_speed)/profile->max_pref;
 
-          if(potential_score<finish_score)
-             InsertInQueue(queue,result2,potential_score);
-         }
+          if(potential_score<total_score)
+             InsertInQueue(rev_queue,result2,potential_score);
 
-      endloop:
+         endloop_rev:
 
-       segmentp=NextSegment(segments,segmentp,node1); /* node1 cannot be a fake node (must be a super-node) */
-      }
+          segment2p=NextSegment(segments,segment2p,node1); /* node1 cannot be a fake node (must be a super-node) */
+         }
 
 #ifdef LIBROUTINO
-    if(!(++loopcount%100000))
-       if(progress_func && !progress_func(progress_value))
-         {
-          progress_abort=1;
-          break;
-         }
+       if(!(++loopcount%100000))
+          if(progress_func && !progress_func(progress_value))
+            {
+             progress_abort=1;
+             break;
+            }
 #endif
+      }
+    else if(!finish_result)
+       break;
    }
 
- FreeQueueList(queue);
+ FreeQueueList(fwd_queue);
+ FreeQueueList(rev_queue);
 
  /* Check it worked */
 
@@ -883,22 +1114,34 @@ static Results *FindMiddleRoute(Nodes *nodes,Segments *segments,Ways *ways,Relat
     return(NULL);
    }
 
+ /* Turn the route round and fill in the start and finish information */
+
+ result1=FirstResult(results);
+
+ while(result1)
+    result1=NextResult(results,result1);
+
+ while(start_result->prev && start_result->prev!=NO_RESULT)
+    start_result=start_result->prev;
+
  FixForwardRoute(results,finish_result);
 
-#if DEBUG
- Result *r=FindResult(results,results->start_node,results->prev_segment);
+ if(!start_result->prev && start_result->next)
+    start_result=start_result->next;
 
- printf("    -------- middle route (start route then via super-nodes/segments)\n");
+ while(finish_result->next && finish_result->next!=NO_RESULT)
+    finish_result=finish_result->next;
 
- while(r)
-   {
-    printf("    node=%"Pindex_t" segment=%"Pindex_t" score=%f%s%s%s\n",r->node,r->segment,r->score,
-                                                                       (IsSuperNode(LookupNode(nodes,r->node,1))?" (super)":""),
-                                                                       (r->node==results->start_node&&r->segment==results->prev_segment?" (start)":""),
-                                                                       (r->node==results->finish_node?" (finish)":""));
+ results->start_node=start_result->node;
+ results->prev_segment=start_result->segment;
 
-    r=r->next;
-   }
+ results->finish_node=finish_result->node;
+ results->last_segment=finish_result->segment;
+
+#if DEBUG
+ printf("    -------- middle route (via super-nodes/segments)\n");
+
+ print_debug_route(nodes,segments,results,NULL,4,+1);
 #endif
 
 #if !DEBUG && !defined(LIBROUTINO)
@@ -935,18 +1178,28 @@ static index_t FindSuperSegment(Nodes *nodes,Segments *segments,Ways *ways,Relat
  Node *supernodep;
  Segment *supersegmentp;
 
+#if DEBUG
+ printf("    FindSuperSegment(...,finish_node=%"Pindex_t",finish_segment=%"Pindex_t")\n",finish_node,finish_segment);
+#endif
+
  if(IsFakeSegment(finish_segment))
     finish_segment=IndexRealSegment(finish_segment);
 
  supernodep=LookupNode(nodes,finish_node,3); /* finish_node cannot be a fake node (must be a super-node) */
- supersegmentp=LookupSegment(segments,finish_segment,4); /* finish_segment cannot be a fake segment. */
+ supersegmentp=LookupSegment(segments,finish_segment,3); /* finish_segment cannot be a fake segment. */
 
  if(IsSuperSegment(supersegmentp))
+   {
+#if DEBUG
+    printf("      -- already super-segment = %"Pindex_t"\n",finish_segment);
+#endif
+
     return(finish_segment);
+   }
 
  /* Loop across all segments */
 
- supersegmentp=FirstSegment(segments,supernodep,4); /* supernode cannot be a fake node (must be a super-node) */
+ supersegmentp=FirstSegment(segments,supernodep,3); /* supernode cannot be a fake node (must be a super-node) */
 
  while(supersegmentp)
    {
@@ -968,6 +1221,11 @@ static index_t FindSuperSegment(Nodes *nodes,Segments *segments,Ways *ways,Relat
        if(result && (distance_t)result->score==DISTANCE(supersegmentp->distance))
          {
           FreeResultsList(results);
+
+#if DEBUG
+          printf("      -- found super-segment = %"Pindex_t"\n",IndexSegment(segments,supersegmentp));
+#endif
+
           return(IndexSegment(segments,supersegmentp));
          }
 
@@ -978,6 +1236,10 @@ static index_t FindSuperSegment(Nodes *nodes,Segments *segments,Ways *ways,Relat
     supersegmentp=NextSegment(segments,supersegmentp,finish_node); /* finish_node cannot be a fake node (must be a super-node) */
    }
 
+#if DEBUG
+    printf("      -- no super-segment = %"Pindex_t"\n",finish_segment);
+#endif
+
  return(finish_segment);
 }
 
@@ -1018,10 +1280,7 @@ static Results *FindSuperRoute(Nodes *nodes,Segments *segments,Ways *ways,Relati
  results=NewResultsList(8);
  queue=NewQueueList(8);
 
- results->start_node=start_node;
- results->prev_segment=NO_SEGMENT;
-
- result1=InsertResult(results,results->start_node,results->prev_segment);
+ result1=InsertResult(results,start_node,NO_SEGMENT);
 
  InsertInQueue(queue,result1,0);
 
@@ -1030,49 +1289,49 @@ static Results *FindSuperRoute(Nodes *nodes,Segments *segments,Ways *ways,Relati
  while((result1=PopFromQueue(queue)))
    {
     Node *node1p=NULL;
-    Segment *segmentp;
+    Segment *segment2p;
     index_t node1,seg1;
 
     node1=result1->node;
     seg1=result1->segment;
 
-    node1p=LookupNode(nodes,node1,3); /* node1 cannot be a fake node */
+    node1p=LookupNode(nodes,node1,4); /* node1 cannot be a fake node */
 
     /* Loop across all segments */
 
-    segmentp=FirstSegment(segments,node1p,3); /* node1 cannot be a fake node */
+    segment2p=FirstSegment(segments,node1p,4); /* node1 cannot be a fake node */
 
-    while(segmentp)
+    while(segment2p)
       {
        Node *node2p=NULL;
        index_t node2,seg2;
        score_t cumulative_score;
 
        /* must be a normal segment */
-       if(!IsNormalSegment(segmentp))
+       if(!IsNormalSegment(segment2p))
           goto endloop;
 
        /* must obey one-way restrictions */
-       if(IsOnewayTo(segmentp,node1))
+       if(IsOnewayTo(segment2p,node1))
          {
-          Way *wayp;
+          Way *way2p;
 
           if(profile->allow!=Transports_Bicycle)
              goto endloop;
 
-          wayp=LookupWay(ways,segmentp->way,2);
+          way2p=LookupWay(ways,segment2p->way,2);
 
-          if(!(wayp->type&Highway_CycleBothWays))
+          if(!(way2p->type&Highway_CycleBothWays))
              goto endloop;
          }
 
-       seg2=IndexSegment(segments,segmentp);
+       seg2=IndexSegment(segments,segment2p);
 
        /* must not perform U-turn */
        if(seg1==seg2)
           goto endloop;
 
-       node2=OtherNode(segmentp,node1);
+       node2=OtherNode(segment2p,node1);
 
        node2p=LookupNode(nodes,node2,4); /* node2 cannot be a fake node */
 
@@ -1081,7 +1340,7 @@ static Results *FindSuperRoute(Nodes *nodes,Segments *segments,Ways *ways,Relati
           goto endloop;
 
        /* Specifically looking for the shortest route to emulate superx.c */
-       cumulative_score=result1->score+(score_t)DISTANCE(segmentp->distance);
+       cumulative_score=result1->score+(score_t)DISTANCE(segment2p->distance);
 
        result2=FindResult(results,node2,seg2);
 
@@ -1105,7 +1364,7 @@ static Results *FindSuperRoute(Nodes *nodes,Segments *segments,Ways *ways,Relati
 
       endloop:
 
-       segmentp=NextSegment(segments,segmentp,node1);
+       segment2p=NextSegment(segments,segment2p,node1);
       }
    }
 
@@ -1118,19 +1377,9 @@ static Results *FindSuperRoute(Nodes *nodes,Segments *segments,Ways *ways,Relati
    {
     if(s->node==finish_node)
       {
-       Result *r=FindResult(results,s->node,s->segment);
-
        printf("        -------- super-route\n");
 
-       while(r)
-         {
-          printf("        node=%"Pindex_t" segment=%"Pindex_t" score=%f%s%s%s\n",r->node,r->segment,r->score,
-                                                                                (IsSuperNode(LookupNode(nodes,r->node,1))?" (super)":""),
-                                                                                (r->node==start_node?" (start)":""),
-                                                                                (r->node==finish_node?" (finish)":""));
-
-          r=r->prev;
-         }
+       print_debug_route(nodes,segments,results,FindResult(results,s->node,s->segment),8,-1);
       }
 
     s=NextResult(results,s);
@@ -1168,8 +1417,8 @@ static Results *FindStartRoutes(Nodes *nodes,Segments *segments,Ways *ways,Relat
  Results *results;
  Queue   *queue,*superqueue;
  Result  *result1,*result2;
- Result  *finish_result=NULL;
- score_t finish_score=INF_SCORE;
+ Result  *start_result,*finish_result=NULL;
+ score_t total_score=INF_SCORE;
  int     nsuper=0,force_uturn=0;
 
 #if DEBUG
@@ -1187,12 +1436,9 @@ static Results *FindStartRoutes(Nodes *nodes,Segments *segments,Ways *ways,Relat
  queue=NewQueueList(8);
  superqueue=NewQueueList(8);
 
- results->start_node=start_node;
- results->prev_segment=prev_segment;
+ start_result=InsertResult(results,start_node,prev_segment);
 
- result1=InsertResult(results,results->start_node,results->prev_segment);
-
- InsertInQueue(queue,result1,0);
+ InsertInQueue(queue,start_result,0);
 
  /* Check for barrier at start waypoint - must perform U-turn */
 
@@ -1209,12 +1455,12 @@ static Results *FindStartRoutes(Nodes *nodes,Segments *segments,Ways *ways,Relat
  while((result1=PopFromQueue(queue)))
    {
     Node *node1p=NULL;
-    Segment *segmentp;
+    Segment *segment2p;
     index_t node1,seg1,seg1r;
     index_t turnrelation=NO_RELATION;
 
     /* score must be better than current best score */
-    if(result1->score>=finish_score)
+    if(result1->score>=total_score)
        continue;
 
     node1=result1->node;
@@ -1235,44 +1481,44 @@ static Results *FindStartRoutes(Nodes *nodes,Segments *segments,Ways *ways,Relat
     /* Loop across all segments */
 
     if(IsFakeNode(node1))
-       segmentp=FirstFakeSegment(node1);
+       segment2p=FirstFakeSegment(node1);
     else
-       segmentp=FirstSegment(segments,node1p,1);
+       segment2p=FirstSegment(segments,node1p,1);
 
-    while(segmentp)
+    while(segment2p)
       {
        Node *node2p=NULL;
-       Way *wayp;
+       Way *way2p;
        index_t node2,seg2,seg2r;
        score_t segment_pref,segment_score,cumulative_score;
        int i;
 
-       node2=OtherNode(segmentp,node1); /* need this here because we use node2 at the end of the loop */
+       node2=OtherNode(segment2p,node1); /* need this here because we use node2 at the end of the loop */
 
        /* must be a normal segment */
-       if(!IsNormalSegment(segmentp))
+       if(!IsNormalSegment(segment2p))
           goto endloop;
 
        /* must obey one-way restrictions (unless profile allows) */
-       if(profile->oneway && IsOnewayTo(segmentp,node1))
+       if(profile->oneway && IsOnewayTo(segment2p,node1))
          {
           if(profile->allow!=Transports_Bicycle)
              goto endloop;
 
-          wayp=LookupWay(ways,segmentp->way,1);
+          way2p=LookupWay(ways,segment2p->way,1);
 
-          if(!(wayp->type&Highway_CycleBothWays))
+          if(!(way2p->type&Highway_CycleBothWays))
              goto endloop;
          }
 
        if(IsFakeNode(node1) || IsFakeNode(node2))
          {
-          seg2 =IndexFakeSegment(segmentp);
+          seg2 =IndexFakeSegment(segment2p);
           seg2r=IndexRealSegment(seg2);
          }
        else
          {
-          seg2 =IndexSegment(segments,segmentp);
+          seg2 =IndexSegment(segments,segment2p);
           seg2r=seg2;
          }
 
@@ -1291,23 +1537,23 @@ static Results *FindStartRoutes(Nodes *nodes,Segments *segments,Ways *ways,Relat
        if(turnrelation!=NO_RELATION && !IsTurnAllowed(relations,turnrelation,node1,seg1r,seg2r,profile->allow))
           goto endloop;
 
-       wayp=LookupWay(ways,segmentp->way,1);
+       way2p=LookupWay(ways,segment2p->way,1);
 
        /* mode of transport must be allowed on the highway */
-       if(!(wayp->allow&profile->allow))
+       if(!(way2p->allow&profile->allow))
           goto endloop;
 
        /* must obey weight restriction (if exists) */
-       if(wayp->weight && wayp->weight<profile->weight)
+       if(way2p->weight && way2p->weight<profile->weight)
           goto endloop;
 
        /* must obey height/width/length restriction (if exists) */
-       if((wayp->height && wayp->height<profile->height) ||
-          (wayp->width  && wayp->width <profile->width ) ||
-          (wayp->length && wayp->length<profile->length))
+       if((way2p->height && way2p->height<profile->height) ||
+          (way2p->width  && way2p->width <profile->width ) ||
+          (way2p->length && way2p->length<profile->length))
           goto endloop;
 
-       segment_pref=profile->highway[HIGHWAY(wayp->type)];
+       segment_pref=profile->highway[HIGHWAY(way2p->type)];
 
        /* highway preferences must allow this highway */
        if(segment_pref==0)
@@ -1316,7 +1562,7 @@ static Results *FindStartRoutes(Nodes *nodes,Segments *segments,Ways *ways,Relat
        for(i=1;i<Property_Count;i++)
           if(ways->file.props & PROPERTIES(i))
             {
-             if(wayp->props & PROPERTIES(i))
+             if(way2p->props & PROPERTIES(i))
                 segment_pref*=profile->props_yes[i];
              else
                 segment_pref*=profile->props_no[i];
@@ -1335,9 +1581,9 @@ static Results *FindStartRoutes(Nodes *nodes,Segments *segments,Ways *ways,Relat
 
        /* calculate the score for the segment and cumulative */
        if(option_quickest==0)
-          segment_score=(score_t)DISTANCE(segmentp->distance)/segment_pref;
+          segment_score=(score_t)DISTANCE(segment2p->distance)/segment_pref;
        else
-          segment_score=(score_t)Duration(segmentp,wayp,profile)/segment_pref;
+          segment_score=(score_t)Duration(segment2p,way2p,profile)/segment_pref;
 
        /* prefer not to follow two fake segments when one would do (special case) */
        if(IsFakeSegment(seg2))
@@ -1345,8 +1591,8 @@ static Results *FindStartRoutes(Nodes *nodes,Segments *segments,Ways *ways,Relat
 
        cumulative_score=result1->score+segment_score;
 
-       /* score must be better than current best score */
-       if(cumulative_score>=finish_score)
+       /* score must be better than current best score (if finish node already found) */
+       if(cumulative_score>=total_score)
           goto endloop;
 
        /* find whether the node/segment combination already exists */
@@ -1379,13 +1625,10 @@ static Results *FindStartRoutes(Nodes *nodes,Segments *segments,Ways *ways,Relat
                 InsertInQueue(queue,result3,result3->score);
             }
 
-          if(cumulative_score<finish_score)
+          if(cumulative_score<total_score)
             {
-             finish_score=cumulative_score;
+             total_score=cumulative_score;
              finish_result=result2;
-
-             results->finish_node=node2;
-             results->last_segment=seg2;
             }
          }
 
@@ -1397,15 +1640,15 @@ static Results *FindStartRoutes(Nodes *nodes,Segments *segments,Ways *ways,Relat
       endloop:
 
        if(IsFakeNode(node1))
-          segmentp=NextFakeSegment(segmentp,node1);
+          segment2p=NextFakeSegment(segment2p,node1);
        else if(IsFakeNode(node2))
-          segmentp=NULL; /* cannot call NextSegment() with a fake segment */
+          segment2p=NULL; /* cannot call NextSegment() with a fake segment */
        else
          {
-          segmentp=NextSegment(segments,segmentp,node1);
+          segment2p=NextSegment(segments,segment2p,node1);
 
-          if(!segmentp && IsFakeNode(finish_node))
-             segmentp=ExtraFakeSegment(node1,finish_node);
+          if(!segment2p && IsFakeNode(finish_node))
+             segment2p=ExtraFakeSegment(node1,finish_node);
          }
       }
    }
@@ -1430,11 +1673,19 @@ static Results *FindStartRoutes(Nodes *nodes,Segments *segments,Ways *ways,Relat
     return(NULL);
    }
 
- /* If we found the finish node then make a proper route */
+ /* Turn the route round and fill in the start and finish information */
+
+ results->start_node  =start_result->node;
+ results->prev_segment=start_result->segment;
 
  if(finish_result)
+   {
     FixForwardRoute(results,finish_result);
 
+    results->finish_node =finish_result->node;
+    results->last_segment=finish_result->segment;
+   }
+
 #if DEBUG
  Result *s=FirstResult(results);
 
@@ -1442,19 +1693,9 @@ static Results *FindStartRoutes(Nodes *nodes,Segments *segments,Ways *ways,Relat
    {
     if(s->node==finish_node || (!IsFakeNode(s->node) && IsSuperNode(LookupNode(nodes,s->node,1))))
       {
-       Result *r=FindResult(results,s->node,s->segment);
-
        printf("    -------- possible start route\n");
 
-       while(r)
-         {
-          printf("    node=%"Pindex_t" segment=%"Pindex_t" score=%f%s%s%s\n",r->node,r->segment,r->score,
-                                                                            (IsSuperNode(LookupNode(nodes,r->node,1))?" (super)":""),
-                                                                            (r->node==start_node&&r->segment==prev_segment?" (start)":""),
-                                                                            (r->node==finish_node?" (finish)":""));
-
-          r=r->prev;
-         }
+       print_debug_route(nodes,segments,results,FindResult(results,s->node,s->segment),4,-1);
       }
 
     s=NextResult(results,s);
@@ -1490,9 +1731,10 @@ static Results *FindStartRoutes(Nodes *nodes,Segments *segments,Ways *ways,Relat
 
 static Results *FindFinishRoutes(Nodes *nodes,Segments *segments,Ways *ways,Relations *relations,Profile *profile,index_t finish_node)
 {
- Results *results,*results2;
+ Results *results,*finish_results;
  Queue   *queue;
- Result  *result1,*result2,*result3;
+ Result  *result1,*result2;
+ Result  *finish_result;
 
 #if DEBUG
  printf("  FindFinishRoutes(...,finish_node=%"Pindex_t")\n",finish_node);
@@ -1505,25 +1747,28 @@ static Results *FindFinishRoutes(Nodes *nodes,Segments *segments,Ways *ways,Rela
 
  /* Create the results and insert the finish node into the queue */
 
+ finish_results=NewResultsList(2);
+
  results=NewResultsList(8);
  queue=NewQueueList(8);
 
- results->finish_node=finish_node;
-
- result1=InsertResult(results,finish_node,NO_SEGMENT);
+ finish_result=InsertResult(finish_results,finish_node,NO_SEGMENT);
 
- InsertInQueue(queue,result1,0);
+ InsertInQueue(queue,finish_result,0);
 
  /* Loop across all nodes in the queue */
 
  while((result1=PopFromQueue(queue)))
    {
     Node *node1p=NULL;
-    Segment *segmentp;
-    index_t node1,seg1,seg1r;
+    Segment *segment1p,*segment2p;
+    Way *way1p;
+    index_t real_node1,node1,seg1,seg1r;
     index_t turnrelation=NO_RELATION;
+    score_t segment1_pref,segment1_score=0;
+    int i;
 
-    node1=result1->node;
+    real_node1=result1->node;
     seg1=result1->segment;
 
     if(seg1!=NO_SEGMENT && IsFakeSegment(seg1))
@@ -1531,104 +1776,145 @@ static Results *FindFinishRoutes(Nodes *nodes,Segments *segments,Ways *ways,Rela
     else
        seg1r=seg1;
 
+    if(seg1!=NO_SEGMENT)
+      {
+       if(IsFakeSegment(seg1))
+          segment1p=LookupFakeSegment(seg1);
+       else
+          segment1p=LookupSegment(segments,seg1,1);
+      }
+
+    if(seg1==NO_SEGMENT)
+       node1=real_node1;
+    else
+       node1=OtherNode(segment1p,real_node1);
+
     if(!IsFakeNode(node1))
        node1p=LookupNode(nodes,node1,1);
 
-    /* lookup if a turn restriction applies */
-    if(profile->turns && node1p && IsTurnRestrictedNode(node1p))
-       turnrelation=FindFirstTurnRelation1(relations,node1); /* working backwards => turn relation sort order doesn't help */
+    /* mode of transport must be allowed through node1 */
+    if(seg1!=NO_SEGMENT)
+       if(node1p && !(node1p->allow&profile->allow))
+          continue;
+
+    if(seg1!=NO_SEGMENT)
+      {
+       way1p=LookupWay(ways,segment1p->way,1);
+
+       segment1_pref=profile->highway[HIGHWAY(way1p->type)];
+
+       for(i=1;i<Property_Count;i++)
+          if(ways->file.props & PROPERTIES(i))
+            {
+             if(way1p->props & PROPERTIES(i))
+                segment1_pref*=profile->props_yes[i];
+             else
+                segment1_pref*=profile->props_no[i];
+            }
+
+       /* calculate the score for the segment */
+       if(option_quickest==0)
+          segment1_score=(score_t)DISTANCE(segment1p->distance)/segment1_pref;
+       else
+          segment1_score=(score_t)Duration(segment1p,way1p,profile)/segment1_pref;
+
+       /* prefer not to follow two fake segments when one would do (special case) */
+       if(IsFakeSegment(seg1))
+          segment1_score*=1.01f;
+      }
 
     /* Loop across all segments */
 
     if(IsFakeNode(node1))
-       segmentp=FirstFakeSegment(node1);
+       segment2p=FirstFakeSegment(node1);
     else
-       segmentp=FirstSegment(segments,node1p,1);
+       segment2p=FirstSegment(segments,node1p,1);
 
-    while(segmentp)
+    while(segment2p)
       {
        Node *node2p=NULL;
-       Way *wayp;
+       Way *way2p;
        index_t node2,seg2,seg2r;
-       score_t segment_pref,segment_score,cumulative_score;
-       int i;
+       score_t segment_pref,cumulative_score;
 
        /* must be a normal segment unless node1 is a super-node (see below). */
-       if((IsFakeNode(node1) || !IsSuperNode(node1p)) && !IsNormalSegment(segmentp))
+       if((IsFakeNode(node1) || !IsSuperNode(node1p)) && !IsNormalSegment(segment2p))
           goto endloop;
 
        /* must be a super segment if node1 is a super-node to give starting super-segment for finding middle route. */
-       if((!IsFakeNode(node1) && IsSuperNode(node1p)) && !IsSuperSegment(segmentp))
+       if((!IsFakeNode(node1) && IsSuperNode(node1p)) && !IsSuperSegment(segment2p))
           goto endloop;
 
        /* must obey one-way restrictions (unless profile allows) */
-       if(profile->oneway && IsOnewayFrom(segmentp,node1)) /* working backwards => disallow oneway *from* node1 */
+       if(profile->oneway && IsOnewayFrom(segment2p,node1)) /* working backwards => disallow oneway *from* node1 */
          {
           if(profile->allow!=Transports_Bicycle)
              goto endloop;
 
-          wayp=LookupWay(ways,segmentp->way,1);
+          way2p=LookupWay(ways,segment2p->way,1);
 
-          if(!(wayp->type&Highway_CycleBothWays))
+          if(!(way2p->type&Highway_CycleBothWays))
              goto endloop;
          }
 
-       node2=OtherNode(segmentp,node1);
+       node2=OtherNode(segment2p,node1);
 
        if(IsFakeNode(node1) || IsFakeNode(node2))
          {
-          seg2 =IndexFakeSegment(segmentp);
+          seg2 =IndexFakeSegment(segment2p);
           seg2r=IndexRealSegment(seg2);
          }
        else
          {
-          seg2 =IndexSegment(segments,segmentp);
+          seg2 =IndexSegment(segments,segment2p);
           seg2r=seg2;
          }
 
-       /* must not perform U-turn (unless profile allows) */
-       if(profile->turns && seg1!=NO_SEGMENT)
+       if(seg1!=NO_SEGMENT)
          {
-          if(IsFakeNode(node1) || !IsSuperNode(node1p))
-            {
-             if(seg1==seg2 || seg1==seg2r || seg1r==seg2 || (seg1r==seg2r && IsFakeUTurn(seg1,seg2)))
-                goto endloop;
-            }
-          else
+          /* must not perform U-turn (unless profile allows) */
+          if(profile->turns)
             {
-             index_t superseg=FindSuperSegment(nodes,segments,ways,relations,profile,node1,seg1);
+             if(IsFakeNode(node1) || !IsSuperNode(node1p))
+               {
+                if(seg1==seg2 || seg1==seg2r || seg1r==seg2 || (seg1r==seg2r && IsFakeUTurn(seg1,seg2)))
+                   goto endloop;
+               }
+             else
+               {
+                index_t superseg=FindSuperSegment(nodes,segments,ways,relations,profile,node1,seg1);
 
-             if(seg2==superseg)
-                goto endloop;
+                if(seg2==superseg)
+                   goto endloop;
+               }
             }
-         }
 
-       /* must obey turn relations */
-       if(turnrelation!=NO_RELATION && seg1!=NO_SEGMENT)
-         {
-          index_t turnrelation2=FindFirstTurnRelation2(relations,node1,seg2r); /* node2 -> node1 -> result1->next->node */
+          /* lookup if a turn restriction applies */
+          if(profile->turns && node1p && IsTurnRestrictedNode(node1p))
+             turnrelation=FindFirstTurnRelation2(relations,node1,seg2r);
 
-          if(turnrelation2!=NO_RELATION && !IsTurnAllowed(relations,turnrelation2,node1,seg2r,seg1r,profile->allow))
+          /* must obey turn relations */
+          if(turnrelation!=NO_RELATION && !IsTurnAllowed(relations,turnrelation,node1,seg2r,seg1r,profile->allow))
              goto endloop;
          }
 
-       wayp=LookupWay(ways,segmentp->way,1);
+       way2p=LookupWay(ways,segment2p->way,1);
 
        /* mode of transport must be allowed on the highway */
-       if(!(wayp->allow&profile->allow))
+       if(!(way2p->allow&profile->allow))
           goto endloop;
 
        /* must obey weight restriction (if exists) */
-       if(wayp->weight && wayp->weight<profile->weight)
+       if(way2p->weight && way2p->weight<profile->weight)
           goto endloop;
 
        /* must obey height/width/length restriction (if exist) */
-       if((wayp->height && wayp->height<profile->height) ||
-          (wayp->width  && wayp->width <profile->width ) ||
-          (wayp->length && wayp->length<profile->length))
+       if((way2p->height && way2p->height<profile->height) ||
+          (way2p->width  && way2p->width <profile->width ) ||
+          (way2p->length && way2p->length<profile->length))
           goto endloop;
 
-       segment_pref=profile->highway[HIGHWAY(wayp->type)];
+       segment_pref=profile->highway[HIGHWAY(way2p->type)];
 
        /* highway preferences must allow this highway */
        if(segment_pref==0)
@@ -1637,7 +1923,7 @@ static Results *FindFinishRoutes(Nodes *nodes,Segments *segments,Ways *ways,Rela
        for(i=1;i<Property_Count;i++)
           if(ways->file.props & PROPERTIES(i))
             {
-             if(wayp->props & PROPERTIES(i))
+             if(way2p->props & PROPERTIES(i))
                 segment_pref*=profile->props_yes[i];
              else
                 segment_pref*=profile->props_no[i];
@@ -1654,30 +1940,22 @@ static Results *FindFinishRoutes(Nodes *nodes,Segments *segments,Ways *ways,Rela
        if(node2p && !(node2p->allow&profile->allow))
           goto endloop;
 
-       /* calculate the score for the segment and cumulative */
-       if(option_quickest==0)
-          segment_score=(score_t)DISTANCE(segmentp->distance)/segment_pref;
-       else
-          segment_score=(score_t)Duration(segmentp,wayp,profile)/segment_pref;
-
-       /* prefer not to follow two fake segments when one would do (special case) */
-       if(IsFakeSegment(seg1))
-          segment_score*=1.01f;
-
-       cumulative_score=result1->score+segment_score;
+       cumulative_score=result1->score+segment1_score;
 
        /* find whether the node/segment combination already exists */
-       result2=FindResult(results,node2,seg2);
+       result2=FindResult(results,node1,seg2); /* adding in reverse => node1,seg2 */
 
        if(!result2) /* New end node */
          {
-          result2=InsertResult(results,node2,seg2);
-          result2->next=result1;   /* working backwards */
+          result2=InsertResult(results,node1,seg2); /* adding in reverse => node1,seg2 */
+          if(result1!=finish_result)
+             result2->next=result1;   /* working backwards */
           result2->score=cumulative_score;
          }
        else if(cumulative_score<result2->score) /* New end node is better */
          {
-          result2->next=result1; /* working backwards */
+          if(result1!=finish_result)
+             result2->next=result1; /* working backwards */
           result2->score=cumulative_score;
          }
        else
@@ -1689,17 +1967,19 @@ static Results *FindFinishRoutes(Nodes *nodes,Segments *segments,Ways *ways,Rela
       endloop:
 
        if(IsFakeNode(node1))
-          segmentp=NextFakeSegment(segmentp,node1);
+          segment2p=NextFakeSegment(segment2p,node1);
        else
-          segmentp=NextSegment(segments,segmentp,node1);
+          segment2p=NextSegment(segments,segment2p,node1);
       }
    }
 
  FreeQueueList(queue);
 
+ FreeResultsList(finish_results);
+
  /* Check it worked */
 
- if(results->number==1)
+ if(results->number==0)
    {
 #if DEBUG
     printf("    Failed\n");
@@ -1714,65 +1994,23 @@ static Results *FindFinishRoutes(Nodes *nodes,Segments *segments,Ways *ways,Rela
     return(NULL);
    }
 
- /* Create a results structure with the node at the end of the segment opposite the start */
-
- results2=NewResultsList(8);
-
- results2->finish_node=results->finish_node;
-
- result3=FirstResult(results);
-
- while(result3)
-   {
-    if(result3->next)
-      {
-       result2=InsertResult(results2,result3->next->node,result3->segment);
-
-       result2->score=result3->next->score;
-      }
+ /* Update the results */
 
-    result3=NextResult(results,result3);
-   }
-
- /* Fix up the result->next pointers */
-
- result3=FirstResult(results);
-
- while(result3)
-   {
-    if(result3->next && result3->next->next)
-      {
-       result1=FindResult(results2,result3->next->node,result3->segment);
-       result2=FindResult(results2,result3->next->next->node,result3->next->segment);
-
-       result1->next=result2;
-      }
-
-    result3=NextResult(results,result3);
-   }
+ results->finish_node=finish_node;
 
 #if DEBUG
- Result *s=FirstResult(results2);
+ Result *s=FirstResult(results);
 
  while(s)
    {
     if(!IsFakeNode(s->node) && IsSuperNode(LookupNode(nodes,s->node,1)))
       {
-       Result *r=FindResult(results2,s->node,s->segment);
-
        printf("    -------- possible finish route\n");
 
-       while(r)
-         {
-          printf("    node=%"Pindex_t" segment=%"Pindex_t" score=%f%s%s\n",r->node,r->segment,r->score,
-                                                                           (IsSuperNode(LookupNode(nodes,r->node,1))?" (super)":""),
-                                                                           (r->node==finish_node?" (finish)":""));
-
-          r=r->next;
-         }
+       print_debug_route(nodes,segments,results,FindResult(results,s->node,s->segment),4,+1);
       }
 
-    s=NextResult(results2,s);
+    s=NextResult(results,s);
    }
 #endif
 
@@ -1781,9 +2019,7 @@ static Results *FindFinishRoutes(Nodes *nodes,Segments *segments,Ways *ways,Rela
     printf_last("Found Finish Route: Nodes checked = %d",results->number);
 #endif
 
- FreeResultsList(results);
-
- return(results2);
+ return(results);
 }
 
 
@@ -1825,30 +2061,25 @@ static Results *CombineRoutes(Nodes *nodes,Segments *segments,Ways *ways,Relatio
 
  combined=NewResultsList(10);
 
- combined->start_node=begin->start_node;
- combined->prev_segment=begin->prev_segment;
-
  /* Insert the start point */
 
  midres=FindResult(middle,middle->start_node,middle->prev_segment);
 
- comres=InsertResult(combined,combined->start_node,combined->prev_segment);
+ comres=InsertResult(combined,begin->start_node,begin->prev_segment);
 
  /* Insert the start of the route */
 
- if(begin->number>1 && midres->next)
+ if(begin->number>1)
    {
     Result *begres;
 
-    midres=FindResult(middle,midres->next->node,midres->next->segment);
-
-    begres=FindResult(begin,midres->node,midres->segment);
+    if(midres->prev==NO_RESULT)
+       begres=FindResult(begin,midres->node,midres->segment);
+    else
+       begres=FindResult(begin,midres->prev->node,midres->prev->segment);
 
     FixForwardRoute(begin,begres);
 
-    if(midres->next && midres->next->node==midres->node)
-       midres=midres->next;
-
     begres=FindResult(begin,begin->start_node,begin->prev_segment);
 
     begres=begres->next;
@@ -1871,7 +2102,7 @@ static Results *CombineRoutes(Nodes *nodes,Segments *segments,Ways *ways,Relatio
 
  /* Sort out the combined route */
 
- while(midres->next)
+ while(midres->next && midres->next!=NO_RESULT)
    {
     Results *results=FindNormalRoute(nodes,segments,ways,relations,profile,comres->node,comres->segment,midres->next->node);
     Result *result;
@@ -1923,11 +2154,13 @@ static Results *CombineRoutes(Nodes *nodes,Segments *segments,Ways *ways,Relatio
     FreeResultsList(results);
 
     midres=midres->next;
+
+    midres->score=comres->score;
    }
 
  /* Insert the end of the route */
 
- if(end->number>1)
+ if(end->number>0)
    {
     Result *endres=FindResult(end,midres->node,midres->segment);
 
@@ -1946,27 +2179,20 @@ static Results *CombineRoutes(Nodes *nodes,Segments *segments,Ways *ways,Relatio
       }
    }
 
- /* Turn the route round */
-
- combined->finish_node=comres->node;
- combined->last_segment=comres->segment;
+ /* Turn the route round and fill in the start and finish information */
 
  FixForwardRoute(combined,comres);
 
-#if DEBUG
- Result *r=FindResult(combined,combined->start_node,combined->prev_segment);
+ combined->start_node=begin->start_node;
+ combined->prev_segment=begin->prev_segment;
 
- printf("      -------- combined route (end-to-end)\n");
+ combined->finish_node=comres->node;
+ combined->last_segment=comres->segment;
 
- while(r)
-   {
-    printf("    node=%"Pindex_t" segment=%"Pindex_t" score=%f%s%s%s\n",r->node,r->segment,r->score,
-                                                                       (IsSuperNode(LookupNode(nodes,r->node,1))?" (super)":""),
-                                                                       (r->node==combined->start_node&&r->segment==combined->prev_segment?" (start)":""),
-                                                                       (r->node==combined->finish_node?" (finish)":""));
+#if DEBUG
+ printf("    -------- combined route (end-to-end)\n");
 
-    r=r->next;
-   }
+ print_debug_route(nodes,segments,combined,NULL,4,+1);
 #endif
 
 #if !DEBUG && !defined(LIBROUTINO)
@@ -1988,48 +2214,80 @@ static Results *CombineRoutes(Nodes *nodes,Segments *segments,Ways *ways,Relatio
 
 static void FixForwardRoute(Results *results,Result *finish_result)
 {
- Result *result2=finish_result;
+ Result *current_result=finish_result;
 
- /* Erase the old route if there is one */
-
- if(results->finish_node!=NO_NODE)
+ do
    {
-    Result *result1=FirstResult(results);
+    Result *result;
 
-    while(result1)
+    if(current_result->prev && current_result->prev!=NO_RESULT)
       {
-       result1->next=NULL;
+       result=current_result->prev;
 
-       result1=NextResult(results,result1);
+       result->next=current_result;
+
+       current_result=result;
       }
+    else
+       current_result=NULL;
    }
+ while(current_result);
+}
 
- /* Create the forward links for the optimum path */
 
- do
-   {
-    Result *result1;
+#if DEBUG
 
-    if(result2->prev)
-      {
-       index_t node1=result2->prev->node;
-       index_t seg1=result2->prev->segment;
+/*++++++++++++++++++++++++++++++++++++++
+  Print a debug message about a route.
 
-       result1=FindResult(results,node1,seg1);
+  Nodes *nodes The set of nodes to use.
 
-#ifndef LIBROUTINO
-       logassert(!result1->next,"Unable to reverse route through results (report a bug)"); /* Bugs elsewhere can lead to infinite loop here. */
-#endif
+  Segments *segments The set of segments to use.
 
-       result1->next=result2;
+  Results *results The set of results to print.
 
-       result2=result1;
-      }
+  Result *first The result to start with or NULL for the first result.
+
+  int indent The number of spaces of indentation at the beginning.
+
+  int direction The direction of travel, -1 = backwards (prev) or +1 = forwards (next).
+  ++++++++++++++++++++++++++++++++++++++*/
+
+static void print_debug_route(Nodes *nodes,Segments *segments,Results *results,Result *first,int indent,int direction)
+{
+ Result *r;
+ char *spaces="        ";
+
+ if(first)
+    r=first;
+ else
+    r=FindResult(results,results->start_node,results->prev_segment);
+
+ while(r && r!=NO_RESULT)
+   {
+    int is_fake_node=IsFakeNode(r->node);
+    int is_super_node=is_fake_node?0:IsSuperNode(LookupNode(nodes,r->node,4));
+    int is_no_segment=(r->segment==NO_SEGMENT);
+    int is_fake_segment=is_no_segment?0:IsFakeSegment(r->segment);
+    int is_super_segment=is_no_segment||is_fake_segment?0:IsSuperSegment(LookupSegment(segments,r->segment,4));
+    int is_normal_segment=is_no_segment||is_fake_segment?0:IsNormalSegment(LookupSegment(segments,r->segment,4));
+    int is_start=r->node==results->start_node&&r->segment==results->prev_segment;
+    int is_finish=r->node==results->finish_node;
+
+    printf("%s %s node=%10"Pindex_t" segment=%10"Pindex_t" score=%8.3f (%s-node,%s-segment)%s%s\n",
+           &spaces[8-indent],
+           (is_start||is_finish?"*":(direction==-1?"^":"v")),
+           r->node,r->segment,r->score,
+           (is_fake_node?"  fake":(is_super_node?" super":"normal")),
+           (is_no_segment?"    no":(is_fake_segment?"  fake":(is_super_segment&&is_normal_segment?"  both":(is_super_segment?" super":"normal")))),
+           (is_start?" [start]":""),
+           (is_finish?" [finish]":""));
+
+    if(direction==-1)
+       r=r->prev;
     else
-       result2=NULL;
+       r=r->next;
    }
- while(result2);
-
- results->finish_node=finish_result->node;
- results->last_segment=finish_result->segment;
 }
+
+#endif
diff --git a/src/output.c b/src/output.c
index 42ebd23..3b34bff 100644
--- a/src/output.c
+++ b/src/output.c
@@ -113,7 +113,6 @@ Routino_Output *PrintRoute(Results **results,int nresults,Nodes *nodes,Segments
  duration_t cum_duration=0;
 
  int point=0;
- int segment_count=0,route_count=0;
  int point_count=0;
  int roundabout=0;
 
@@ -664,7 +663,12 @@ Routino_Output *PrintRoute(Results **results,int nresults,Nodes *nodes,Segments
              char *type;
 
              if(important==ROUTINO_POINT_WAYPOINT)
-                type=translation->html_waypoint;
+               {
+                type=malloc(sizeof("<span class='w'>")+strlen(translation->html_waypoint)+1+4+sizeof("</span>")+1);
+
+                sprintf(type,"<span class='w'>%s#%d</span>",translation->html_waypoint,
+                                     (point_count==0?results[point]->start_waypoint:results[point]->finish_waypoint));
+               }
              else if(important==ROUTINO_POINT_MINI_RB)
                 type=translation->html_roundabout;
              else
@@ -689,7 +693,7 @@ Routino_Output *PrintRoute(Results **results,int nresults,Nodes *nodes,Segments
                {
                 /* <tr class='n'><td>Start at <span class='w'>Waypoint</span>, head <span class='b'>*heading*</span> */
                 fprintf(htmlfile,translation->html_start,
-                                 translation->html_waypoint,
+                                 type,
                                  next_bearing);
                }
              else if(next_result) /* middle point */
@@ -704,7 +708,7 @@ Routino_Output *PrintRoute(Results **results,int nresults,Nodes *nodes,Segments
                   }
                 else
                   {
-                   /* <tr class='n'><td>At junction, go <span class='t'>*direction*</span> heading <span class='b'>*heading*</span> */
+                   /* <tr class='n'><td>At *waypoint/roundabout/junction*, go <span class='t'>*direction*</span> heading <span class='b'>*heading*</span> */
                    fprintf(htmlfile,translation->html_node,
                                     type,
                                     turn,
@@ -715,12 +719,15 @@ Routino_Output *PrintRoute(Results **results,int nresults,Nodes *nodes,Segments
                {
                 /* <tr class='n'><td>Stop at <span class='w'>Waypoint</span> */
                 fprintf(htmlfile,translation->html_stop,
-                                 translation->html_waypoint);
+                                 type);
 
                 /* <tr class='t'><td><span class='j'>Total *distance* km, *time* minutes</span> */
                 fprintf(htmlfile,translation->html_total,
                                  distance_to_km(cum_distance),duration_to_minutes(cum_duration));
                }
+
+             if(important==ROUTINO_POINT_WAYPOINT)
+                free(type);
             }
 
           if(htmllist)
@@ -729,7 +736,12 @@ Routino_Output *PrintRoute(Results **results,int nresults,Nodes *nodes,Segments
              char *type;
 
              if(important==ROUTINO_POINT_WAYPOINT)
-                type=translation->nothtml_waypoint;
+               {
+                type=malloc(strlen(translation->nothtml_waypoint)+1+4+1);
+
+                sprintf(type,"%s#%d",translation->nothtml_waypoint,
+                                     (point_count==0?results[point]->start_waypoint:results[point]->finish_waypoint));
+               }
              else if(important==ROUTINO_POINT_MINI_RB)
                 type=translation->nothtml_roundabout;
              else
@@ -775,12 +787,12 @@ Routino_Output *PrintRoute(Results **results,int nresults,Nodes *nodes,Segments
                {
                 /* Start: At Waypoint, head *heading* */
                 strl=strlen(translation->nothtml_start)+
-                     strlen(translation->nothtml_waypoint)+strlen(next_bearingraw)+1;
+                     strlen(type)+strlen(next_bearingraw)+1;
 
                 htmllist->desc1=malloc(strl);
 
                 sprintf(htmllist->desc1,translation->nothtml_start,
-                                        translation->nothtml_waypoint,
+                                        type,
                                         next_bearingraw);
 
                 htmllist->name=strcpy(malloc(strlen(next_waynameraw)+1),next_waynameraw);
@@ -802,7 +814,7 @@ Routino_Output *PrintRoute(Results **results,int nresults,Nodes *nodes,Segments
                   }
                 else
                   {
-                   /* At: Junction, go *direction* heading *heading* */
+                   /* At: Waypoint/Roundabout/Junction, go *direction* heading *heading* */
                    strl=strlen(translation->nothtml_node)+
                         strlen(type)+strlen(turnraw)+strlen(next_bearingraw)+1;
 
@@ -821,12 +833,12 @@ Routino_Output *PrintRoute(Results **results,int nresults,Nodes *nodes,Segments
                {
                 /* Stop: At Waypoint */
                 strl=strlen(translation->nothtml_stop)+
-                     strlen(translation->nothtml_waypoint)+1;
+                     strlen(type)+1;
 
                 htmllist->desc1=malloc(strl);
 
                 sprintf(htmllist->desc1,translation->nothtml_stop,
-                                        translation->nothtml_waypoint);
+                                        type);
 
                 /* Total: *distance* km, *time* minutes */
                 strl=strlen(translation->nothtml_total)+8+8+1;
@@ -840,6 +852,9 @@ Routino_Output *PrintRoute(Results **results,int nresults,Nodes *nodes,Segments
                }
 
              htmllist->bearing=next_bearing_int;
+
+             if(important==ROUTINO_POINT_WAYPOINT)
+                free(type);
             }
 
           if(gpxroutefile)
@@ -856,15 +871,15 @@ Routino_Output *PrintRoute(Results **results,int nresults,Nodes *nodes,Segments
 
              if(point_count==0) /* first point */
                {
-                fprintf(gpxroutefile,"<rtept lat=\"%.6f\" lon=\"%.6f\"><name>%s</name>\n",
+                fprintf(gpxroutefile,"<rtept lat=\"%.6f\" lon=\"%.6f\"><name>%s%02d</name>\n",
                                      radians_to_degrees(latitude),radians_to_degrees(longitude),
-                                     translation->gpx_start);
+                                     translation->gpx_waypt,results[point]->start_waypoint);
                }
              else if(!next_result) /* end point */
                {
-                fprintf(gpxroutefile,"<rtept lat=\"%.6f\" lon=\"%.6f\"><name>%s</name>\n",
+                fprintf(gpxroutefile,"<rtept lat=\"%.6f\" lon=\"%.6f\"><name>%s%02d</name>\n",
                                      radians_to_degrees(latitude),radians_to_degrees(longitude),
-                                     translation->gpx_finish);
+                                     translation->gpx_waypt,results[point]->finish_waypoint);
                 fprintf(gpxroutefile,"<desc>");
                 fprintf(gpxroutefile,translation->gpx_final,
                                      distance_to_km(cum_distance),duration_to_minutes(cum_duration));
@@ -873,13 +888,13 @@ Routino_Output *PrintRoute(Results **results,int nresults,Nodes *nodes,Segments
              else            /* middle point */
                {
                 if(important==ROUTINO_POINT_WAYPOINT)
-                   fprintf(gpxroutefile,"<rtept lat=\"%.6f\" lon=\"%.6f\"><name>%s%d</name>\n",
+                   fprintf(gpxroutefile,"<rtept lat=\"%.6f\" lon=\"%.6f\"><name>%s%02d</name>\n",
                                         radians_to_degrees(latitude),radians_to_degrees(longitude),
-                                        translation->gpx_inter,++segment_count);
+                                        translation->gpx_waypt,results[point]->finish_waypoint);
                 else
                    fprintf(gpxroutefile,"<rtept lat=\"%.6f\" lon=\"%.6f\"><name>%s%03d</name>\n",
                                         radians_to_degrees(latitude),radians_to_degrees(longitude),
-                                        translation->gpx_trip,++route_count);
+                                        translation->gpx_trip,point_count);
                }
             }
 
@@ -888,7 +903,13 @@ Routino_Output *PrintRoute(Results **results,int nresults,Nodes *nodes,Segments
              char *type;
 
              if(important==ROUTINO_POINT_WAYPOINT)
-                type="Waypt";
+               {
+                type=malloc(sizeof("Waypt")+1+4+1);
+
+                sprintf(type,"Waypt#%d",(point_count==0?results[point]->start_waypoint:results[point]->finish_waypoint));
+               }
+             else if(important==ROUTINO_POINT_MINI_RB)
+                type="Mini-RB";
              else
                 type="Junct";
 
@@ -920,6 +941,9 @@ Routino_Output *PrintRoute(Results **results,int nresults,Nodes *nodes,Segments
                                  ((22+next_bearing_int)/45+4)%8-4,
                                  next_waynameraw);
                }
+
+             if(important==ROUTINO_POINT_WAYPOINT)
+                free(type);
             }
 
           if(textlist)
@@ -1014,7 +1038,11 @@ Routino_Output *PrintRoute(Results **results,int nresults,Nodes *nodes,Segments
              char *type;
 
              if(important==ROUTINO_POINT_WAYPOINT)
-                type="Waypt";
+               {
+                type=malloc(sizeof("Waypt")+1+4+1);
+
+                sprintf(type,"Waypt#%d",(point_count==0?results[point]->start_waypoint:results[point]->finish_waypoint));
+               }
              else if(important==ROUTINO_POINT_UTURN)
                 type="U-turn";
              else if(important==ROUTINO_POINT_MINI_RB)
@@ -1048,6 +1076,9 @@ Routino_Output *PrintRoute(Results **results,int nresults,Nodes *nodes,Segments
                                     bearing_int,
                                     waynameraw);
                }
+
+             if(important==ROUTINO_POINT_WAYPOINT)
+                free(type);
             }
 
           if(textalllist)
diff --git a/src/profiles.c b/src/profiles.c
index 22247fa..4866e23 100644
--- a/src/profiles.c
+++ b/src/profiles.c
@@ -824,6 +824,9 @@ int UpdateProfile(Profile *profile,Ways *ways)
        profile->max_pref=profile->highway[i];
    }
 
+ if(profile->max_pref==0)
+    return(1);
+
  /* Normalise the property preferences into the range ~0 -> 1 */
 
  for(i=1;i<Property_Count;i++)
@@ -856,13 +859,11 @@ int UpdateProfile(Profile *profile,Ways *ways)
  profile->max_speed=0;
 
  for(i=1;i<Highway_Count;i++)
-   {
-    if(profile->speed[i]<0.01f)
-       profile->speed[i]=0.01f;
-
     if(profile->speed[i]>profile->max_speed)
        profile->max_speed=profile->speed[i];
-   }
+
+ if(profile->max_speed==0)
+    return(1);
 
  /* Find the most preferred property combination */
 
diff --git a/src/results.h b/src/results.h
index 736211b..c85c81f 100644
--- a/src/results.h
+++ b/src/results.h
@@ -3,7 +3,7 @@
 
  Part of the Routino routing software.
  ******************/ /******************
- This file Copyright 2008-2014 Andrew M. Bishop
+ This file Copyright 2008-2015 Andrew M. Bishop
 
  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU Affero General Public License as published by
@@ -30,8 +30,11 @@
 
 /* Constants */
 
+/* A fake result pointer. */
+#define NO_RESULT ((Result*)~0)
+
 /*+ A result is not currently queued. +*/
-#define NOT_QUEUED (uint32_t)(0)
+#define NOT_QUEUED ((uint32_t)0)
 
 
 /* Data structures */
diff --git a/src/router+lib.c b/src/router+lib.c
index e59dbc6..48b8937 100644
--- a/src/router+lib.c
+++ b/src/router+lib.c
@@ -68,7 +68,7 @@ int main(int argc,char** argv)
  int                  html=0,gpx_track=0,gpx_route=0,text=0,text_all=0,none=0,use_stdout=0;
  int                  list_html=0,list_html_all=0,list_text=0,list_text_all=0;
  int                  arg;
- int                  first_waypoint=NWAYPOINTS,last_waypoint=1,inc_dec_waypoint,waypoint,nwaypoints=0;
+ int                  first_waypoint=NWAYPOINTS,last_waypoint=1,waypoint,nwaypoints=0;
  int                  routing_options;
 
  /* Check the libroutino API version */
@@ -100,10 +100,20 @@ int main(int argc,char** argv)
        profiles=&argv[arg][11];
     else if(!strncmp(argv[arg],"--translations=",15))
        translations=&argv[arg][15];
-    else if(!strcmp(argv[arg],"--reverse"))
-       reverse=1;
-    else if(!strcmp(argv[arg],"--loop"))
-       loop=1;
+    else if(!strncmp(argv[arg],"--reverse",9))
+      {
+       if(argv[arg][9]=='=')
+          reverse=atoi(&argv[arg][10]);
+       else
+          reverse=1;
+      }
+    else if(!strncmp(argv[arg],"--loop",6))
+      {
+       if(argv[arg][6]=='=')
+          loop=atoi(&argv[arg][7]);
+       else
+          loop=1;
+      }
     else if(!strcmp(argv[arg],"--output-html"))
        html=1;
     else if(!strcmp(argv[arg],"--output-gpx-track"))
@@ -335,49 +345,31 @@ int main(int argc,char** argv)
 
  /* Check the profile is valid for use with this database */
 
- Routino_ValidateProfile(database,profile);
-
- /* Check for reverse direction */
-
- if(reverse)
+ if(Routino_ValidateProfile(database,profile)!=ROUTINO_ERROR_NONE)
    {
-    int temp;
-
-    temp=first_waypoint;
-    first_waypoint=last_waypoint;
-    last_waypoint=temp;
-
-    last_waypoint--;
-
-    inc_dec_waypoint=-1;
-   }
- else
-   {
-    last_waypoint++;
-
-    inc_dec_waypoint=1;
+    fprintf(stderr,"Error: Profile is invalid or not compatible with database.\n");
+    exit(EXIT_FAILURE);
    }
 
  /* Loop through all waypoints */
 
  nwaypoints=0;
 
- for(waypoint=first_waypoint;waypoint!=last_waypoint;waypoint+=inc_dec_waypoint)
-    if(point_used[waypoint]==3)
-      {
-       waypoints[nwaypoints]=Routino_FindWaypoint(database,profile,point_lat[waypoint],point_lon[waypoint]);
+ for(waypoint=first_waypoint;waypoint<=last_waypoint;waypoint++)
+   {
+    if(point_used[waypoint]!=3)
+       continue;
 
-       if(!waypoints[nwaypoints])
-         {
-          fprintf(stderr,"Error: Cannot find node close to specified point %d.\n",waypoint);
-          exit(EXIT_FAILURE);
-         }
+    waypoints[nwaypoints]=Routino_FindWaypoint(database,profile,point_lat[waypoint],point_lon[waypoint]);
 
-       nwaypoints++;
+    if(!waypoints[nwaypoints])
+      {
+       fprintf(stderr,"Error: Cannot find node close to specified point %d.\n",waypoint);
+       exit(EXIT_FAILURE);
       }
 
- if(loop)
-    waypoints[nwaypoints++]=waypoints[0];
+    nwaypoints++;
+   }
 
  /* Create the route */
 
@@ -399,6 +391,9 @@ int main(int argc,char** argv)
  if(list_text)     routing_options|=ROUTINO_ROUTE_LIST_TEXT;
  if(list_text_all) routing_options|=ROUTINO_ROUTE_LIST_TEXT_ALL;
 
+ if(reverse) routing_options|=ROUTINO_ROUTE_REVERSE;
+ if(loop)    routing_options|=ROUTINO_ROUTE_LOOP;
+
  route=Routino_CalculateRoute(database,profile,translation,waypoints,nwaypoints,routing_options,NULL);
 
  if(Routino_errno>=ROUTINO_ERROR_NO_ROUTE_1)
@@ -513,7 +508,9 @@ static void print_usage(int detail,const char *argerr,const char *err)
  if(detail<0)
    {
     fprintf(stderr,
-            "Routino version " ROUTINO_VERSION " " ROUTINO_URL ".\n"
+            "Routino version " ROUTINO_VERSION " " ROUTINO_URL " "
+            "[Library version: %s, API version: %d]\n",
+            Routino_Version,Routino_APIVersion
             );
    }
 
diff --git a/src/router.c b/src/router.c
index 8cb667a..2bc082c 100644
--- a/src/router.c
+++ b/src/router.c
@@ -76,6 +76,7 @@ int main(int argc,char** argv)
  Results     *results[NWAYPOINTS+1]={NULL};
  int          point_used[NWAYPOINTS+1]={0};
  double       point_lon[NWAYPOINTS+1],point_lat[NWAYPOINTS+1];
+ index_t      point_node[NWAYPOINTS+1]={NO_NODE};
  double       heading=-999;
  int          help_profile=0,help_profile_xml=0,help_profile_json=0,help_profile_pl=0;
  char        *dirname=NULL,*prefix=NULL;
@@ -85,11 +86,12 @@ int main(int argc,char** argv)
  Transport    transport=Transport_None;
  Profile     *profile=NULL;
  Translation *translation=NULL;
- index_t      start_node,finish_node=NO_NODE,first_node=NO_NODE;
+ index_t      start_node,finish_node=NO_NODE;
  index_t      join_segment=NO_SEGMENT;
  int          arg,nresults=0;
  waypoint_t   start_waypoint,finish_waypoint=NO_WAYPOINT;
- waypoint_t   first_waypoint=NWAYPOINTS,last_waypoint=1,inc_dec_waypoint,waypoint;
+ waypoint_t   first_waypoint=NWAYPOINTS,last_waypoint=1,waypoint;
+ int          inc_dec_waypoint=1;
 
  printf_program_start();
 
@@ -124,10 +126,20 @@ int main(int argc,char** argv)
        translations=&argv[arg][15];
     else if(!strcmp(argv[arg],"--exact-nodes-only"))
        exactnodes=1;
-    else if(!strcmp(argv[arg],"--reverse"))
-       reverse=1;
-    else if(!strcmp(argv[arg],"--loop"))
-       loop=1;
+    else if(!strncmp(argv[arg],"--reverse",9))
+      {
+       if(argv[arg][9]=='=')
+          reverse=atoi(&argv[arg][10]);
+       else
+          reverse=1;
+      }
+    else if(!strncmp(argv[arg],"--loop",6))
+      {
+       if(argv[arg][6]=='=')
+          loop=atoi(&argv[arg][7]);
+       else
+          loop=1;
+      }
     else if(!strcmp(argv[arg],"--quiet"))
        option_quiet=1;
     else if(!strcmp(argv[arg],"--loggable"))
@@ -154,6 +166,63 @@ int main(int argc,char** argv)
        profilename=&argv[arg][10];
     else if(!strncmp(argv[arg],"--language=",11))
        language=&argv[arg][11];
+    else if(!strcmp(argv[arg],"--shortest"))
+       option_quickest=0;
+    else if(!strcmp(argv[arg],"--quickest"))
+       option_quickest=1;
+    else if(!strncmp(argv[arg],"--lon",5) && isdigit(argv[arg][5]))
+      {
+       int point;
+       char *p=&argv[arg][6];
+
+       while(isdigit(*p)) p++;
+       if(*p++!='=')
+          print_usage(0,argv[arg],NULL);
+
+       point=atoi(&argv[arg][5]);
+       if(point>NWAYPOINTS || point_used[point]&1)
+          print_usage(0,argv[arg],NULL);
+
+       point_lon[point]=degrees_to_radians(atof(p));
+       point_used[point]+=1;
+
+       if(point<first_waypoint)
+          first_waypoint=point;
+       if(point>last_waypoint)
+          last_waypoint=point;
+      }
+    else if(!strncmp(argv[arg],"--lat",5) && isdigit(argv[arg][5]))
+      {
+       int point;
+       char *p=&argv[arg][6];
+
+       while(isdigit(*p)) p++;
+       if(*p++!='=')
+          print_usage(0,argv[arg],NULL);
+
+       point=atoi(&argv[arg][5]);
+       if(point>NWAYPOINTS || point_used[point]&2)
+          print_usage(0,argv[arg],NULL);
+
+       point_lat[point]=degrees_to_radians(atof(p));
+       point_used[point]+=2;
+
+       if(point<first_waypoint)
+          first_waypoint=point;
+       if(point>last_waypoint)
+          last_waypoint=point;
+      }
+    else if(!strncmp(argv[arg],"--heading=",10))
+      {
+       double h=atof(&argv[arg][10]);
+
+       if(h>=-360 && h<=360)
+         {
+          heading=h;
+
+          if(heading<0) heading+=360;
+         }
+      }
     else if(!strncmp(argv[arg],"--transport=",12))
       {
        transport=TransportType(&argv[arg][12]);
@@ -228,71 +297,12 @@ int main(int argc,char** argv)
     profile->transport=transport;
    }
 
- /* Parse the other command line arguments */
+ /* Parse the other command line arguments that modify the profile */
 
  for(arg=1;arg<argc;arg++)
    {
     if(!argv[arg])
        continue;
-    else if(!strcmp(argv[arg],"--shortest"))
-       option_quickest=0;
-    else if(!strcmp(argv[arg],"--quickest"))
-       option_quickest=1;
-    else if(!strncmp(argv[arg],"--lon",5) && isdigit(argv[arg][5]))
-      {
-       int point;
-       char *p=&argv[arg][6];
-
-       while(isdigit(*p)) p++;
-       if(*p++!='=')
-          print_usage(0,argv[arg],NULL);
-
-       point=atoi(&argv[arg][5]);
-       if(point>NWAYPOINTS || point_used[point]&1)
-          print_usage(0,argv[arg],NULL);
-
-       point_lon[point]=degrees_to_radians(atof(p));
-       point_used[point]+=1;
-
-       if(point<first_waypoint)
-          first_waypoint=point;
-       if(point>last_waypoint)
-          last_waypoint=point;
-      }
-    else if(!strncmp(argv[arg],"--lat",5) && isdigit(argv[arg][5]))
-      {
-       int point;
-       char *p=&argv[arg][6];
-
-       while(isdigit(*p)) p++;
-       if(*p++!='=')
-          print_usage(0,argv[arg],NULL);
-
-       point=atoi(&argv[arg][5]);
-       if(point>NWAYPOINTS || point_used[point]&2)
-          print_usage(0,argv[arg],NULL);
-
-       point_lat[point]=degrees_to_radians(atof(p));
-       point_used[point]+=2;
-
-       if(point<first_waypoint)
-          first_waypoint=point;
-       if(point>last_waypoint)
-          last_waypoint=point;
-      }
-    else if(!strncmp(argv[arg],"--heading=",10))
-      {
-       double h=atof(&argv[arg][10]);
-
-       if(h>=-360 && h<=360)
-         {
-          heading=h;
-
-          if(heading<0) heading+=360;
-         }
-      }
-    else if(!strncmp(argv[arg],"--transport=",12))
-       ; /* Done this already */
     else if(!strncmp(argv[arg],"--highway-",10))
       {
        Highway highway;
@@ -417,15 +427,6 @@ int main(int argc,char** argv)
     exit(EXIT_SUCCESS);
    }
 
- /* Check the waypoints are valid */
-
- for(waypoint=1;waypoint<=NWAYPOINTS;waypoint++)
-    if(point_used[waypoint]==1 || point_used[waypoint]==2)
-       print_usage(0,NULL,"All waypoints must have latitude and longitude.");
-
- if(first_waypoint>=last_waypoint)
-    print_usage(0,NULL,"At least two waypoints must be specified.");
-
  /* Load in the selected translation */
 
  if(option_file_html || option_file_gpx_route || option_file_gpx_track || option_file_text || option_file_text_all)
@@ -484,6 +485,15 @@ int main(int argc,char** argv)
       }
    }
 
+ /* Check the waypoints are valid */
+
+ for(waypoint=1;waypoint<=NWAYPOINTS;waypoint++)
+    if(point_used[waypoint]==1 || point_used[waypoint]==2)
+       print_usage(0,NULL,"All waypoints must have latitude and longitude.");
+
+ if(first_waypoint>=last_waypoint)
+    print_usage(0,NULL,"At least two waypoints must be specified.");
+
  /* Load in the data - Note: No error checking because Load*List() will call exit() in case of an error. */
 
  if(!option_quiet)
@@ -500,7 +510,7 @@ int main(int argc,char** argv)
  if(!option_quiet)
     printf_last("Loaded Files: nodes, segments, ways & relations");
 
- /* Check the profile compared to the types of ways available */
+ /* Check the profile is valid for use with this database */
 
  if(UpdateProfile(profile,OSMWays))
    {
@@ -508,51 +518,25 @@ int main(int argc,char** argv)
     exit(EXIT_FAILURE);
    }
 
- /* Check for reverse direction */
+ /* Find all waypoints */
 
- if(reverse)
-   {
-    waypoint_t temp;
-
-    temp=first_waypoint;
-    first_waypoint=last_waypoint;
-    last_waypoint=temp;
-
-    last_waypoint--;
-
-    inc_dec_waypoint=-1;
-   }
- else
-   {
-    last_waypoint++;
-
-    inc_dec_waypoint=1;
-   }
-
- /* Loop through all pairs of waypoints */
-
- for(waypoint=first_waypoint;waypoint!=last_waypoint;waypoint+=inc_dec_waypoint)
+ for(waypoint=first_waypoint;waypoint<=last_waypoint;waypoint++)
    {
     distance_t distmax=km_to_distance(MAXSEARCH);
     distance_t distmin;
     index_t segment=NO_SEGMENT;
-    index_t node1,node2;
+    index_t node1,node2,node=NO_NODE;
 
     if(point_used[waypoint]!=3)
        continue;
 
-    if(!option_quiet)
-       printf_first("Finding Closest Point: Waypoint %d",waypoint);
-
     /* Find the closest point */
 
-    start_node=finish_node;
-    start_waypoint=finish_waypoint;
+    if(!option_quiet)
+       printf_first("Finding Closest Point: Waypoint %d",waypoint);
 
     if(exactnodes)
-      {
-       finish_node=FindClosestNode(OSMNodes,OSMSegments,OSMWays,point_lat[waypoint],point_lon[waypoint],distmax,profile,&distmin);
-      }
+       node=FindClosestNode(OSMNodes,OSMSegments,OSMWays,point_lat[waypoint],point_lon[waypoint],distmax,profile,&distmin);
     else
       {
        distance_t dist1,dist2;
@@ -560,52 +544,82 @@ int main(int argc,char** argv)
        segment=FindClosestSegment(OSMNodes,OSMSegments,OSMWays,point_lat[waypoint],point_lon[waypoint],distmax,profile,&distmin,&node1,&node2,&dist1,&dist2);
 
        if(segment!=NO_SEGMENT)
-          finish_node=CreateFakes(OSMNodes,OSMSegments,waypoint,LookupSegment(OSMSegments,segment,1),node1,node2,dist1,dist2);
-       else
-          finish_node=NO_NODE;
+          node=CreateFakes(OSMNodes,OSMSegments,waypoint,LookupSegment(OSMSegments,segment,1),node1,node2,dist1,dist2);
       }
 
     if(!option_quiet)
        printf_last("Found Closest Point: Waypoint %d",waypoint);
 
-    if(finish_node==NO_NODE)
+    if(node==NO_NODE)
       {
        fprintf(stderr,"Error: Cannot find node close to specified point %d.\n",waypoint);
        exit(EXIT_FAILURE);
       }
 
-    finish_waypoint=waypoint;
-
     if(!option_quiet)
       {
        double lat,lon;
 
-       if(IsFakeNode(finish_node))
-          GetFakeLatLong(finish_node,&lat,&lon);
+       if(IsFakeNode(node))
+          GetFakeLatLong(node,&lat,&lon);
        else
-          GetLatLong(OSMNodes,finish_node,NULL,&lat,&lon);
+          GetLatLong(OSMNodes,node,NULL,&lat,&lon);
 
-       if(IsFakeNode(finish_node))
+       if(IsFakeNode(node))
           printf("Waypoint %d is segment %"Pindex_t" (node %"Pindex_t" -> %"Pindex_t"): %3.6f %4.6f = %2.3f km\n",waypoint,segment,node1,node2,
                  radians_to_degrees(lon),radians_to_degrees(lat),distance_to_km(distmin));
        else
-          printf("Waypoint %d is node %"Pindex_t": %3.6f %4.6f = %2.3f km\n",waypoint,finish_node,
+          printf("Waypoint %d is node %"Pindex_t": %3.6f %4.6f = %2.3f km\n",waypoint,node,
                  radians_to_degrees(lon),radians_to_degrees(lat),distance_to_km(distmin));
       }
 
-    /* Check the nodes */
+    point_node[waypoint]=node;
+   }
 
-    if(start_node==NO_NODE)
+ /* Check for reverse direction */
+
+ if(reverse)
+   {
+    waypoint_t temp;
+
+    temp=first_waypoint;
+    first_waypoint=last_waypoint;
+    last_waypoint=temp;
+
+    inc_dec_waypoint=-1;
+   }
+
+ /* Loop through all pairs of waypoints */
+
+ if(loop && reverse)
+   {
+    finish_node=point_node[last_waypoint];
+
+    finish_waypoint=last_waypoint;
+   }
+
+ for(waypoint=first_waypoint;waypoint!=(last_waypoint+inc_dec_waypoint);waypoint+=inc_dec_waypoint)
+   {
+    if(point_used[waypoint]!=3)
        continue;
 
-    if(first_node==NO_NODE)
-       first_node=start_node;
+    start_node=finish_node;
+    finish_node=point_node[waypoint];
+
+    start_waypoint=finish_waypoint;
+    finish_waypoint=waypoint;
+
+    if(start_node==NO_NODE)
+       continue;
 
     if(heading!=-999 && join_segment==NO_SEGMENT)
        join_segment=FindClosestSegmentHeading(OSMNodes,OSMSegments,OSMWays,start_node,heading,profile);
 
     /* Calculate the route */
 
+    if(!option_quiet)
+       printf("Routing from waypoint %d to waypoint %d\n",start_waypoint,finish_waypoint);
+
     results[nresults]=CalculateRoute(OSMNodes,OSMSegments,OSMWays,OSMRelations,profile,start_node,join_segment,finish_node,start_waypoint,finish_waypoint);
 
     if(!results[nresults])
@@ -616,11 +630,23 @@ int main(int argc,char** argv)
     nresults++;
    }
 
- /* Finish the loop */
-
- if(loop && finish_node!=NO_NODE)
+ if(loop && !reverse)
    {
-    results[nresults]=CalculateRoute(OSMNodes,OSMSegments,OSMWays,OSMRelations,profile,finish_node,join_segment,first_node,last_waypoint,first_waypoint);
+    start_node=finish_node;
+    finish_node=point_node[first_waypoint];
+
+    start_waypoint=finish_waypoint;
+    finish_waypoint=first_waypoint;
+
+    /* Calculate the route */
+
+    if(!option_quiet)
+       printf("Routing from waypoint %d to waypoint %d\n",start_waypoint,finish_waypoint);
+
+    results[nresults]=CalculateRoute(OSMNodes,OSMSegments,OSMWays,OSMRelations,profile,start_node,join_segment,finish_node,start_waypoint,finish_waypoint);
+
+    if(!results[nresults])
+       exit(EXIT_FAILURE);
 
     nresults++;
    }
diff --git a/src/routino.c b/src/routino.c
index f193a85..9f58d6e 100644
--- a/src/routino.c
+++ b/src/routino.c
@@ -35,11 +35,16 @@
 #include "profiles.h"
 #include "translations.h"
 
+#include "version.h"
+
 
 /* Global variables */
 
 /*+ Contains the libroutino API version number. +*/
-DLL_PUBLIC int Routino_APIVersion=ROUTINO_API_VERSION;
+DLL_PUBLIC const int Routino_APIVersion=ROUTINO_API_VERSION;
+
+/*+ Contains the Routino version number. +*/
+DLL_PUBLIC const char *Routino_Version=ROUTINO_VERSION;
 
 /*+ Contains the error number of the most recent Routino function (one of the ROUTINO_ERROR_* values). +*/
 DLL_PUBLIC int Routino_errno=ROUTINO_ERROR_NONE;
@@ -551,7 +556,7 @@ DLL_PUBLIC Routino_Waypoint *Routino_FindWaypoint(Routino_Database *database,Rou
 DLL_PUBLIC Routino_Output *Routino_CalculateRoute(Routino_Database *database,Routino_Profile *profile,Routino_Translation *translation,
                                                   Routino_Waypoint **waypoints,int nwaypoints,int options,Routino_ProgressFunc progress)
 {
- int waypoint;
+ int first_waypoint,last_waypoint,this_waypoint,nwaypoints_routed,inc_dec_waypoint,start_waypoint,finish_waypoint=-1;
  index_t start_node,finish_node=NO_NODE;
  index_t join_segment=NO_SEGMENT;
  Results **results;
@@ -618,15 +623,40 @@ DLL_PUBLIC Routino_Output *Routino_CalculateRoute(Routino_Database *database,Rou
  progress_value=0.0;
  progress_abort=0;
 
+ /* Check for loop and reverse options */
+
+ if(options&ROUTINO_ROUTE_LOOP)
+    nwaypoints_routed=nwaypoints+1;
+ else
+    nwaypoints_routed=nwaypoints;
+
+ if(options&ROUTINO_ROUTE_REVERSE)
+   {
+    first_waypoint=nwaypoints_routed-1;
+    last_waypoint=0;
+
+    inc_dec_waypoint=-1;
+   }
+ else
+   {
+    first_waypoint=0;
+    last_waypoint=nwaypoints_routed-1;
+
+    inc_dec_waypoint=1;
+   }
+
  /* Loop through all pairs of waypoints */
 
  results=calloc(sizeof(Results*),nwaypoints);
 
- for(waypoint=0;waypoint<nwaypoints;waypoint++)
+ for(this_waypoint=first_waypoint;this_waypoint!=(last_waypoint+inc_dec_waypoint);this_waypoint+=inc_dec_waypoint)
    {
+    int waypoint=this_waypoint%nwaypoints;
+    int waypoint_count=(this_waypoint-first_waypoint)*inc_dec_waypoint;
+
     if(progress_func)
       {
-       progress_value=(double)waypoint/(double)(nwaypoints+1);
+       progress_value=(double)waypoint_count/(double)(nwaypoints_routed+1);
 
        if(!progress_func(progress_value))
          {
@@ -635,34 +665,36 @@ DLL_PUBLIC Routino_Output *Routino_CalculateRoute(Routino_Database *database,Rou
          }
       }
 
+    start_waypoint=finish_waypoint;
     start_node=finish_node;
 
-    finish_node=CreateFakes(database->nodes,database->segments,waypoint+1,
+    finish_waypoint=waypoint+1;
+    finish_node=CreateFakes(database->nodes,database->segments,finish_waypoint,
                             LookupSegment(database->segments,waypoints[waypoint]->segment,1),
                             waypoints[waypoint]->node1,waypoints[waypoint]->node2,waypoints[waypoint]->dist1,waypoints[waypoint]->dist2);
 
-    if(waypoint==0)
+    if(waypoint_count==0)
        continue;
 
-    results[waypoint-1]=CalculateRoute(database->nodes,database->segments,database->ways,database->relations,
-                                       profile,start_node,join_segment,finish_node,waypoint,waypoint+1);
+    results[waypoint_count-1]=CalculateRoute(database->nodes,database->segments,database->ways,database->relations,
+                                             profile,start_node,join_segment,finish_node,start_waypoint,finish_waypoint);
 
-    if(!results[waypoint-1])
+    if(!results[waypoint_count-1])
       {
        if(progress_func && progress_abort)
           Routino_errno=ROUTINO_ERROR_PROGRESS_ABORTED;
        else
-          Routino_errno=ROUTINO_ERROR_NO_ROUTE_1+waypoint-1;
+          Routino_errno=ROUTINO_ERROR_NO_ROUTE_1-1+start_waypoint;
 
        goto tidy_and_exit;
       }
 
-    join_segment=results[waypoint-1]->last_segment;
+    join_segment=results[waypoint_count-1]->last_segment;
    }
 
  if(progress_func)
    {
-    progress_value=(double)waypoint/(double)(nwaypoints+1);
+    progress_value=(double)this_waypoint/(double)(nwaypoints_routed+1);
 
     if(!progress_func(progress_value))
       {
@@ -673,7 +705,7 @@ DLL_PUBLIC Routino_Output *Routino_CalculateRoute(Routino_Database *database,Rou
 
  /* Print the route */
 
- output=PrintRoute(results,nwaypoints-1,database->nodes,database->segments,database->ways,profile,translation);
+ output=PrintRoute(results,nwaypoints_routed-1,database->nodes,database->segments,database->ways,profile,translation);
 
  if(progress_func && !progress_func(1.0))
    {
@@ -687,9 +719,9 @@ DLL_PUBLIC Routino_Output *Routino_CalculateRoute(Routino_Database *database,Rou
 
  DeleteFakeNodes();
 
- for(waypoint=0;waypoint<nwaypoints;waypoint++)
-    if(results[waypoint])
-       FreeResultsList(results[waypoint]);
+ for(this_waypoint=0;this_waypoint<nwaypoints;this_waypoint++)
+    if(results[this_waypoint])
+       FreeResultsList(results[this_waypoint]);
 
  free(results);
 
diff --git a/src/routino.h b/src/routino.h
index f1c5ab2..cef1b4c 100644
--- a/src/routino.h
+++ b/src/routino.h
@@ -61,7 +61,7 @@ extern "C"
 
  /* Routino library API version */
 
-#define ROUTINO_API_VERSION                 7 /*+ A version number for the Routino API. +*/
+#define ROUTINO_API_VERSION                 8 /*+ A version number for the Routino API. +*/
 
 
  /* Routino error constants */
@@ -118,6 +118,9 @@ extern "C"
 #define ROUTINO_ROUTE_LIST_TEXT           512 /*+ Output a linked list of points containing the text file information. +*/
 #define ROUTINO_ROUTE_LIST_TEXT_ALL      1024 /*+ Output a linked list of points containing the text all file information. +*/
 
+#define ROUTINO_ROUTE_LOOP               2048 /*+ Route between the points in a loop returning to the first point. +*/
+#define ROUTINO_ROUTE_REVERSE            4096 /*+ Route between the points in reverse order. +*/
+
 
  /* Routino output point types */
 
@@ -238,7 +241,10 @@ extern "C"
  /* Routino error number variable */
 
  /*+ Contains the libroutino API version number. +*/
- DLL_PUBLIC extern int Routino_APIVersion;
+ DLL_PUBLIC extern const int Routino_APIVersion;
+
+ /*+ Contains the Routino version number. +*/
+ DLL_PUBLIC extern const char *Routino_Version;
 
  /*+ Contains the error number of the most recent Routino function (one of the ROUTINO_ERROR_* values). +*/
  DLL_PUBLIC extern int Routino_errno;
diff --git a/src/segments.h b/src/segments.h
index d07e0a2..c8999e0 100644
--- a/src/segments.h
+++ b/src/segments.h
@@ -5,7 +5,7 @@
 
  Part of the Routino routing software.
  ******************/ /******************
- This file Copyright 2008-2015 Andrew M. Bishop
+ This file Copyright 2008-2016 Andrew M. Bishop
 
  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU Affero General Public License as published by
@@ -248,7 +248,7 @@ static inline index_t IndexSegment(Segments *segments,Segment *segmentp)
 
 static inline Segment *NextSegment(Segments *segments,Segment *segmentp,index_t node)
 {
- int position=(int)(segmentp-&segments->cached[-1]);
+ int position=(int)(segmentp-segments->cached)+1;
 
  if(segmentp->node1==node)
    {
diff --git a/src/test/Makefile b/src/test/Makefile
index 66ab1a7..3c1fc67 100644
--- a/src/test/Makefile
+++ b/src/test/Makefile
@@ -24,11 +24,6 @@ include ../../Makefile.conf
 
 # executables
 
-ROUTINO_EXE=planetsplitter$(.EXE) planetsplitter-slim$(.EXE) \
-            router$(.EXE)         router-slim$(.EXE) \
-            router+lib$(.EXE)     router+lib-slim$(.EXE) \
-            filedumper$(.EXE)     filedumper-slim$(.EXE)
-
 EXE=is-fast-math$(.EXE)
 
 # Compilation targets
@@ -48,7 +43,7 @@ test : test-exe $(EXE)
 ########
 
 test-exe :
-	cd .. && $(MAKE) $(ROUTINO_EXE)
+	cd .. && $(MAKE) all-exe all-lib
 
 is-fast-math$(.EXE) : is-fast-math.o
 	$(LD) $< -o $@ $(LDFLAGS)
diff --git a/src/test/expected/coincident-waypoint-WP01.txt b/src/test/expected/coincident-waypoint-WP01.txt
index e2daa78..8956d9f 100644
--- a/src/test/expected/coincident-waypoint-WP01.txt
+++ b/src/test/expected/coincident-waypoint-WP01.txt
@@ -4,9 +4,9 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.216904	  -0.520770	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.216904	  -0.520770	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.217286	  -0.520780	       7 	Junct-	0.042	 0.03	 0.04	  0.0	 96	 181	main 1
- -0.217741	  -0.520789	      -2 	Waypt	0.050	 0.03	 0.09	  0.1	 96	 181	main 1
- -0.217741	  -0.520789	      -3 	Waypt	0.000	 0.00	 0.09	  0.1	 96	 270	main 1
+ -0.217741	  -0.520789	      -2 	Waypt#2	0.050	 0.03	 0.09	  0.1	 96	 181	main 1
+ -0.217741	  -0.520789	      -3 	Waypt#3	0.000	 0.00	 0.09	  0.1	 96	 270	main 1
  -0.218523	  -0.520806	       6 	Junct-	0.086	 0.05	 0.18	  0.1	 96	 181	main 1
- -0.219080	  -0.520824	      -4 	Waypt	0.061	 0.04	 0.24	  0.1	 96	 181	main 1
+ -0.219080	  -0.520824	      -4 	Waypt#4	0.061	 0.04	 0.24	  0.1	 96	 181	main 1
diff --git a/src/test/expected/coincident-waypoint-WP02.txt b/src/test/expected/coincident-waypoint-WP02.txt
index 8123d44..1f3c65c 100644
--- a/src/test/expected/coincident-waypoint-WP02.txt
+++ b/src/test/expected/coincident-waypoint-WP02.txt
@@ -4,8 +4,8 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.216959	  -0.520771	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.216959	  -0.520771	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.217286	  -0.520780	       7 	Junct-	0.036	 0.02	 0.04	  0.0	 96	 181	main 1
- -0.218523	  -0.520806	       6 	Waypt	0.137	 0.09	 0.17	  0.1	 96	 181	main 1
- -0.218523	  -0.520806	       6 	Waypt	0.000	 0.00	 0.17	  0.1	 96	 270	main 1
- -0.219117	  -0.520825	      -4 	Waypt	0.065	 0.04	 0.24	  0.1	 96	 181	main 1
+ -0.218523	  -0.520806	       6 	Waypt#2	0.137	 0.09	 0.17	  0.1	 96	 181	main 1
+ -0.218523	  -0.520806	       6 	Waypt#3	0.000	 0.00	 0.17	  0.1	 96	 270	main 1
+ -0.219117	  -0.520825	      -4 	Waypt#4	0.065	 0.04	 0.24	  0.1	 96	 181	main 1
diff --git a/src/test/expected/coincident-waypoint-WP03.txt b/src/test/expected/coincident-waypoint-WP03.txt
index 32b1fa8..fc69f44 100644
--- a/src/test/expected/coincident-waypoint-WP03.txt
+++ b/src/test/expected/coincident-waypoint-WP03.txt
@@ -4,9 +4,9 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.217022	  -0.520773	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
- -0.217022	  -0.520773	      -2 	Waypt	0.000	 0.00	 0.00	  0.0	 96	 270	main 1
+ -0.217022	  -0.520773	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
+ -0.217022	  -0.520773	      -2 	Waypt#2	0.000	 0.00	 0.00	  0.0	 96	 270	main 1
  -0.217286	  -0.520780	       7 	Junct-	0.029	 0.02	 0.03	  0.0	 96	 181	main 1
  -0.218523	  -0.520806	       6 	Junct-	0.137	 0.09	 0.17	  0.1	 96	 181	main 1
- -0.219153	  -0.520826	      -3 	Waypt	0.069	 0.04	 0.23	  0.1	 96	 181	main 1
- -0.219153	  -0.520826	      -4 	Waypt	0.000	 0.00	 0.23	  0.1	 96	 270	main 1
+ -0.219153	  -0.520826	      -3 	Waypt#3	0.069	 0.04	 0.23	  0.1	 96	 181	main 1
+ -0.219153	  -0.520826	      -4 	Waypt#4	0.000	 0.00	 0.23	  0.1	 96	 270	main 1
diff --git a/src/test/expected/coincident-waypoint-WP04.txt b/src/test/expected/coincident-waypoint-WP04.txt
index c79a7e2..97f9a3d 100644
--- a/src/test/expected/coincident-waypoint-WP04.txt
+++ b/src/test/expected/coincident-waypoint-WP04.txt
@@ -4,7 +4,7 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.217286	  -0.520780	       7 	Waypt	0.000	 0.00	 0.00	  0.0			
- -0.217286	  -0.520780	       7 	Waypt	0.000	 0.00	 0.00	  0.0	 96	 270	main 1
- -0.218523	  -0.520806	       6 	Waypt	0.137	 0.09	 0.14	  0.1	 96	 181	main 1
- -0.218523	  -0.520806	       6 	Waypt	0.000	 0.00	 0.14	  0.1	 96	 270	main 1
+ -0.217286	  -0.520780	       7 	Waypt#1	0.000	 0.00	 0.00	  0.0			
+ -0.217286	  -0.520780	       7 	Waypt#2	0.000	 0.00	 0.00	  0.0	 96	 270	main 1
+ -0.218523	  -0.520806	       6 	Waypt#3	0.137	 0.09	 0.14	  0.1	 96	 181	main 1
+ -0.218523	  -0.520806	       6 	Waypt#4	0.000	 0.00	 0.14	  0.1	 96	 270	main 1
diff --git a/src/test/expected/cycle-both-ways-WP01.txt b/src/test/expected/cycle-both-ways-WP01.txt
index 60c2867..a2caaa0 100644
--- a/src/test/expected/cycle-both-ways-WP01.txt
+++ b/src/test/expected/cycle-both-ways-WP01.txt
@@ -4,7 +4,7 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.221402	  -0.520913	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.221402	  -0.520913	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220268	  -0.520863	       8*	Junct	0.125	 0.08	 0.12	  0.1	 96	   2	main 2
  -0.220062	  -0.521204	       2 	Inter	0.044	 0.03	 0.17	  0.1	 96	 301	roundabout
  -0.219665	  -0.521190	       3 	Inter	0.044	 0.03	 0.21	  0.1	 96	   1	roundabout
@@ -13,4 +13,4 @@
  -0.219271	  -0.519532	      17 	Inter	0.118	 0.15	 0.42	  0.3	 48	  66	residential road
  -0.219302	  -0.518908	      20*	Junct	0.069	 0.09	 0.49	  0.4	 48	  92	residential road
  -0.220811	  -0.518939	      19*	Junct-	0.167	 0.10	 0.65	  0.5	 96	 181	main 3
- -0.221319	  -0.518949	      -2 	Waypt	0.056	 0.04	 0.71	  0.6	 96	 181	main 3
+ -0.221319	  -0.518949	      -2 	Waypt#2	0.056	 0.04	 0.71	  0.6	 96	 181	main 3
diff --git a/src/test/expected/cycle-both-ways-WP02.txt b/src/test/expected/cycle-both-ways-WP02.txt
index 22a5bc8..5432687 100644
--- a/src/test/expected/cycle-both-ways-WP02.txt
+++ b/src/test/expected/cycle-both-ways-WP02.txt
@@ -4,7 +4,7 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.221402	  -0.520913	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.221402	  -0.520913	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220268	  -0.520863	       8*	Junct	0.125	 0.38	 0.12	  0.4	 20	   2	main 2
  -0.220062	  -0.521204	       2 	Inter	0.044	 0.13	 0.17	  0.5	 20	 301	roundabout
  -0.219665	  -0.521190	       3 	Junct-	0.044	 0.13	 0.21	  0.6	 20	   1	roundabout
@@ -13,4 +13,4 @@
  -0.220082	  -0.520522	      14*	Junct	0.043	 0.13	 0.34	  1.0	 20	 181	roundabout
  -0.220768	  -0.519742	      16 	Inter	0.115	 0.34	 0.46	  1.4	 20	 131	residential road
  -0.220811	  -0.518939	      19*	Junct	0.089	 0.27	 0.55	  1.6	 20	  93	residential road
- -0.221319	  -0.518949	      -2 	Waypt	0.056	 0.17	 0.60	  1.8	 20	 181	main 3
+ -0.221319	  -0.518949	      -2 	Waypt#2	0.056	 0.17	 0.60	  1.8	 20	 181	main 3
diff --git a/src/test/expected/dead-ends-WP01.txt b/src/test/expected/dead-ends-WP01.txt
index 72c402f..891724a 100644
--- a/src/test/expected/dead-ends-WP01.txt
+++ b/src/test/expected/dead-ends-WP01.txt
@@ -4,14 +4,14 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219535	  -0.521016	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219535	  -0.521016	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220223	  -0.521052	       5*	Junct-	0.076	 0.05	 0.08	  0.0	 96	 182	main 1
  -0.220666	  -0.521060	       4*	Junct	0.049	 0.03	 0.12	  0.1	 96	 180	main 1
  -0.220702	  -0.519478	      12*	Junct	0.176	 0.22	 0.30	  0.3	 48	  91	high street
- -0.220263	  -0.519309	      13*	Waypt	0.052	 0.07	 0.35	  0.4	 48	  21	dead-end 1
+ -0.220263	  -0.519309	      13*	Waypt#2	0.052	 0.07	 0.35	  0.4	 48	  21	dead-end 1
  -0.220702	  -0.519478	      12*	Junct	0.052	 0.07	 0.41	  0.4	 48	 201	dead-end 1
  -0.220739	  -0.517804	      18*	Junct	0.186	 0.23	 0.59	  0.7	 48	  91	high street
  -0.220782	  -0.516137	      24*	Junct	0.185	 0.23	 0.78	  0.9	 48	  91	high street
  -0.220817	  -0.514062	      32*	Junct	0.230	 0.29	 1.01	  1.2	 48	  90	high street
  -0.220344	  -0.514042	      33*	Junct-	0.052	 0.03	 1.06	  1.2	 96	   2	main 2
- -0.219539	  -0.514007	      -3 	Waypt	0.089	 0.06	 1.15	  1.3	 96	   2	main 2
+ -0.219539	  -0.514007	      -3 	Waypt#3	0.089	 0.06	 1.15	  1.3	 96	   2	main 2
diff --git a/src/test/expected/dead-ends-WP02.txt b/src/test/expected/dead-ends-WP02.txt
index 0becf02..f6d2732 100644
--- a/src/test/expected/dead-ends-WP02.txt
+++ b/src/test/expected/dead-ends-WP02.txt
@@ -4,16 +4,16 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219535	  -0.521016	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219535	  -0.521016	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220223	  -0.521052	       5*	Junct-	0.076	 0.05	 0.08	  0.0	 96	 182	main 1
  -0.220666	  -0.521060	       4*	Junct	0.049	 0.03	 0.12	  0.1	 96	 180	main 1
  -0.220702	  -0.519478	      12*	Junct	0.176	 0.22	 0.30	  0.3	 48	  91	high street
  -0.220263	  -0.519309	      13*	Junct-	0.052	 0.07	 0.35	  0.4	 48	  21	dead-end 1
- -0.219924	  -0.519179	      14 	Waypt	0.040	 0.05	 0.39	  0.4	 48	  20	dead-end 1
+ -0.219924	  -0.519179	      14 	Waypt#2	0.040	 0.05	 0.39	  0.4	 48	  20	dead-end 1
  -0.220263	  -0.519309	      13*	Junct-	0.040	 0.05	 0.43	  0.5	 48	 200	dead-end 1
  -0.220702	  -0.519478	      12*	Junct	0.052	 0.07	 0.48	  0.5	 48	 201	dead-end 1
  -0.220739	  -0.517804	      18*	Junct	0.186	 0.23	 0.67	  0.8	 48	  91	high street
  -0.220782	  -0.516137	      24*	Junct	0.185	 0.23	 0.86	  1.0	 48	  91	high street
  -0.220817	  -0.514062	      32*	Junct	0.230	 0.29	 1.09	  1.3	 48	  90	high street
  -0.220344	  -0.514042	      33*	Junct-	0.052	 0.03	 1.14	  1.3	 96	   2	main 2
- -0.219539	  -0.514007	      -3 	Waypt	0.089	 0.06	 1.23	  1.4	 96	   2	main 2
+ -0.219539	  -0.514007	      -3 	Waypt#3	0.089	 0.06	 1.23	  1.4	 96	   2	main 2
diff --git a/src/test/expected/dead-ends-WP03.txt b/src/test/expected/dead-ends-WP03.txt
index 52cdacc..be02398 100644
--- a/src/test/expected/dead-ends-WP03.txt
+++ b/src/test/expected/dead-ends-WP03.txt
@@ -4,13 +4,13 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219535	  -0.521016	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219535	  -0.521016	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220223	  -0.521052	       5*	Junct-	0.076	 0.05	 0.08	  0.0	 96	 182	main 1
  -0.220666	  -0.521060	       4*	Junct	0.049	 0.03	 0.12	  0.1	 96	 180	main 1
  -0.220702	  -0.519478	      12*	Junct	0.176	 0.22	 0.30	  0.3	 48	  91	high street
  -0.220263	  -0.519309	      13*	Junct-	0.052	 0.07	 0.35	  0.4	 48	  21	dead-end 1
  -0.219924	  -0.519179	      14 	Inter	0.040	 0.05	 0.39	  0.4	 48	  20	dead-end 1
- -0.219567	  -0.519373	      -2 	Waypt	0.045	 0.06	 0.44	  0.5	 48	 331	dead-end 1
+ -0.219567	  -0.519373	      -2 	Waypt#2	0.045	 0.06	 0.44	  0.5	 48	 331	dead-end 1
  -0.219924	  -0.519179	      14 	Inter	0.045	 0.06	 0.48	  0.5	 48	 151	dead-end 1
  -0.220263	  -0.519309	      13*	Junct-	0.040	 0.05	 0.52	  0.6	 48	 200	dead-end 1
  -0.220702	  -0.519478	      12*	Junct	0.052	 0.07	 0.57	  0.6	 48	 201	dead-end 1
@@ -18,4 +18,4 @@
  -0.220782	  -0.516137	      24*	Junct	0.185	 0.23	 0.95	  1.1	 48	  91	high street
  -0.220817	  -0.514062	      32*	Junct	0.230	 0.29	 1.18	  1.4	 48	  90	high street
  -0.220344	  -0.514042	      33*	Junct-	0.052	 0.03	 1.23	  1.4	 96	   2	main 2
- -0.219539	  -0.514007	      -3 	Waypt	0.089	 0.06	 1.32	  1.5	 96	   2	main 2
+ -0.219539	  -0.514007	      -3 	Waypt#3	0.089	 0.06	 1.32	  1.5	 96	   2	main 2
diff --git a/src/test/expected/dead-ends-WP04.txt b/src/test/expected/dead-ends-WP04.txt
index 941340a..473f863 100644
--- a/src/test/expected/dead-ends-WP04.txt
+++ b/src/test/expected/dead-ends-WP04.txt
@@ -4,14 +4,14 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219535	  -0.521016	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219535	  -0.521016	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220223	  -0.521052	       5*	Junct-	0.076	 0.05	 0.08	  0.0	 96	 182	main 1
  -0.220666	  -0.521060	       4*	Junct	0.049	 0.03	 0.12	  0.1	 96	 180	main 1
  -0.220702	  -0.519478	      12*	Junct	0.176	 0.22	 0.30	  0.3	 48	  91	high street
  -0.220263	  -0.519309	      13*	Junct-	0.052	 0.07	 0.35	  0.4	 48	  21	dead-end 1
  -0.219924	  -0.519179	      14 	Inter	0.040	 0.05	 0.39	  0.4	 48	  20	dead-end 1
  -0.219235	  -0.519555	      11 	Inter	0.087	 0.11	 0.48	  0.5	 48	 331	dead-end 1
- -0.218387	  -0.519137	      15 	Waypt	0.105	 0.13	 0.58	  0.7	 48	  26	dead-end 1
+ -0.218387	  -0.519137	      15 	Waypt#2	0.105	 0.13	 0.58	  0.7	 48	  26	dead-end 1
  -0.219235	  -0.519555	      11 	Inter	0.105	 0.13	 0.69	  0.8	 48	 206	dead-end 1
  -0.219924	  -0.519179	      14 	Inter	0.087	 0.11	 0.78	  0.9	 48	 151	dead-end 1
  -0.220263	  -0.519309	      13*	Junct-	0.040	 0.05	 0.82	  0.9	 48	 200	dead-end 1
@@ -20,4 +20,4 @@
  -0.220782	  -0.516137	      24*	Junct	0.185	 0.23	 1.24	  1.5	 48	  91	high street
  -0.220817	  -0.514062	      32*	Junct	0.230	 0.29	 1.47	  1.8	 48	  90	high street
  -0.220344	  -0.514042	      33*	Junct-	0.052	 0.03	 1.52	  1.8	 96	   2	main 2
- -0.219539	  -0.514007	      -3 	Waypt	0.089	 0.06	 1.61	  1.8	 96	   2	main 2
+ -0.219539	  -0.514007	      -3 	Waypt#3	0.089	 0.06	 1.61	  1.8	 96	   2	main 2
diff --git a/src/test/expected/dead-ends-WP05.txt b/src/test/expected/dead-ends-WP05.txt
index c243705..533c6a6 100644
--- a/src/test/expected/dead-ends-WP05.txt
+++ b/src/test/expected/dead-ends-WP05.txt
@@ -4,14 +4,14 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219535	  -0.521016	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219535	  -0.521016	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220223	  -0.521052	       5*	Junct-	0.076	 0.05	 0.08	  0.0	 96	 182	main 1
  -0.220666	  -0.521060	       4*	Junct	0.049	 0.03	 0.12	  0.1	 96	 180	main 1
  -0.220702	  -0.519478	      12*	Junct	0.176	 0.22	 0.30	  0.3	 48	  91	high street
  -0.220739	  -0.517804	      18*	Junct	0.186	 0.23	 0.49	  0.5	 48	  91	high street
- -0.220296	  -0.517634	      20*	Waypt	0.052	 0.07	 0.54	  0.6	 48	  21	dead-end 2
+ -0.220296	  -0.517634	      20*	Waypt#2	0.052	 0.07	 0.54	  0.6	 48	  21	dead-end 2
  -0.220739	  -0.517804	      18*	Junct	0.052	 0.07	 0.59	  0.7	 48	 201	dead-end 2
  -0.220782	  -0.516137	      24*	Junct	0.185	 0.23	 0.78	  0.9	 48	  91	high street
  -0.220817	  -0.514062	      32*	Junct	0.230	 0.29	 1.01	  1.2	 48	  90	high street
  -0.220344	  -0.514042	      33*	Junct-	0.052	 0.03	 1.06	  1.2	 96	   2	main 2
- -0.219539	  -0.514007	      -3 	Waypt	0.089	 0.06	 1.15	  1.3	 96	   2	main 2
+ -0.219539	  -0.514007	      -3 	Waypt#3	0.089	 0.06	 1.15	  1.3	 96	   2	main 2
diff --git a/src/test/expected/dead-ends-WP06.txt b/src/test/expected/dead-ends-WP06.txt
index 086b2fe..dcb1ea6 100644
--- a/src/test/expected/dead-ends-WP06.txt
+++ b/src/test/expected/dead-ends-WP06.txt
@@ -4,16 +4,16 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219535	  -0.521016	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219535	  -0.521016	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220223	  -0.521052	       5*	Junct-	0.076	 0.05	 0.08	  0.0	 96	 182	main 1
  -0.220666	  -0.521060	       4*	Junct	0.049	 0.03	 0.12	  0.1	 96	 180	main 1
  -0.220702	  -0.519478	      12*	Junct	0.176	 0.22	 0.30	  0.3	 48	  91	high street
  -0.220739	  -0.517804	      18*	Junct	0.186	 0.23	 0.49	  0.5	 48	  91	high street
  -0.220296	  -0.517634	      20*	Junct-	0.052	 0.07	 0.54	  0.6	 48	  21	dead-end 2
- -0.219991	  -0.517512	      21 	Waypt	0.036	 0.04	 0.57	  0.6	 48	  21	dead-end 2
+ -0.219991	  -0.517512	      21 	Waypt#2	0.036	 0.04	 0.57	  0.6	 48	  21	dead-end 2
  -0.220296	  -0.517634	      20*	Junct-	0.036	 0.04	 0.61	  0.7	 48	 201	dead-end 2
  -0.220739	  -0.517804	      18*	Junct	0.052	 0.07	 0.66	  0.7	 48	 201	dead-end 2
  -0.220782	  -0.516137	      24*	Junct	0.185	 0.23	 0.85	  1.0	 48	  91	high street
  -0.220817	  -0.514062	      32*	Junct	0.230	 0.29	 1.08	  1.3	 48	  90	high street
  -0.220344	  -0.514042	      33*	Junct-	0.052	 0.03	 1.13	  1.3	 96	   2	main 2
- -0.219539	  -0.514007	      -3 	Waypt	0.089	 0.06	 1.22	  1.4	 96	   2	main 2
+ -0.219539	  -0.514007	      -3 	Waypt#3	0.089	 0.06	 1.22	  1.4	 96	   2	main 2
diff --git a/src/test/expected/dead-ends-WP07.txt b/src/test/expected/dead-ends-WP07.txt
index 946c8a9..9f0214d 100644
--- a/src/test/expected/dead-ends-WP07.txt
+++ b/src/test/expected/dead-ends-WP07.txt
@@ -4,18 +4,18 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219535	  -0.521016	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219535	  -0.521016	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220223	  -0.521052	       5*	Junct-	0.076	 0.05	 0.08	  0.0	 96	 182	main 1
  -0.220666	  -0.521060	       4*	Junct	0.049	 0.03	 0.12	  0.1	 96	 180	main 1
  -0.220702	  -0.519478	      12*	Junct	0.176	 0.22	 0.30	  0.3	 48	  91	high street
  -0.220739	  -0.517804	      18*	Junct	0.186	 0.23	 0.49	  0.5	 48	  91	high street
  -0.220296	  -0.517634	      20*	Junct-	0.052	 0.07	 0.54	  0.6	 48	  21	dead-end 2
  -0.219991	  -0.517512	      21 	Inter	0.036	 0.04	 0.57	  0.6	 48	  21	dead-end 2
- -0.219635	  -0.517707	      -2 	Waypt	0.045	 0.06	 0.62	  0.7	 48	 331	dead-end 2
+ -0.219635	  -0.517707	      -2 	Waypt#2	0.045	 0.06	 0.62	  0.7	 48	 331	dead-end 2
  -0.219991	  -0.517512	      21 	Inter	0.045	 0.06	 0.67	  0.7	 48	 151	dead-end 2
  -0.220296	  -0.517634	      20*	Junct-	0.036	 0.04	 0.70	  0.8	 48	 201	dead-end 2
  -0.220739	  -0.517804	      18*	Junct	0.052	 0.07	 0.75	  0.9	 48	 201	dead-end 2
  -0.220782	  -0.516137	      24*	Junct	0.185	 0.23	 0.94	  1.1	 48	  91	high street
  -0.220817	  -0.514062	      32*	Junct	0.230	 0.29	 1.17	  1.4	 48	  90	high street
  -0.220344	  -0.514042	      33*	Junct-	0.052	 0.03	 1.22	  1.4	 96	   2	main 2
- -0.219539	  -0.514007	      -3 	Waypt	0.089	 0.06	 1.31	  1.5	 96	   2	main 2
+ -0.219539	  -0.514007	      -3 	Waypt#3	0.089	 0.06	 1.31	  1.5	 96	   2	main 2
diff --git a/src/test/expected/dead-ends-WP08.txt b/src/test/expected/dead-ends-WP08.txt
index eedd51d..7a2b476 100644
--- a/src/test/expected/dead-ends-WP08.txt
+++ b/src/test/expected/dead-ends-WP08.txt
@@ -4,14 +4,14 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219535	  -0.521016	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219535	  -0.521016	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220223	  -0.521052	       5*	Junct-	0.076	 0.05	 0.08	  0.0	 96	 182	main 1
  -0.220666	  -0.521060	       4*	Junct	0.049	 0.03	 0.12	  0.1	 96	 180	main 1
  -0.220702	  -0.519478	      12*	Junct	0.176	 0.22	 0.30	  0.3	 48	  91	high street
  -0.220739	  -0.517804	      18*	Junct	0.186	 0.23	 0.49	  0.5	 48	  91	high street
  -0.220782	  -0.516137	      24*	Junct	0.185	 0.23	 0.67	  0.8	 48	  91	high street
- -0.220361	  -0.515961	      25*	Waypt	0.050	 0.06	 0.72	  0.8	 48	  22	dead-end 3
+ -0.220361	  -0.515961	      25*	Waypt#2	0.050	 0.06	 0.72	  0.8	 48	  22	dead-end 3
  -0.220782	  -0.516137	      24*	Junct	0.050	 0.06	 0.77	  0.9	 48	 202	dead-end 3
  -0.220817	  -0.514062	      32*	Junct	0.230	 0.29	 1.00	  1.2	 48	  90	high street
  -0.220344	  -0.514042	      33*	Junct-	0.052	 0.03	 1.05	  1.2	 96	   2	main 2
- -0.219539	  -0.514007	      -3 	Waypt	0.089	 0.06	 1.14	  1.3	 96	   2	main 2
+ -0.219539	  -0.514007	      -3 	Waypt#3	0.089	 0.06	 1.14	  1.3	 96	   2	main 2
diff --git a/src/test/expected/dead-ends-WP09.txt b/src/test/expected/dead-ends-WP09.txt
index 97db084..4dfbc2f 100644
--- a/src/test/expected/dead-ends-WP09.txt
+++ b/src/test/expected/dead-ends-WP09.txt
@@ -4,16 +4,16 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219535	  -0.521016	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219535	  -0.521016	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220223	  -0.521052	       5*	Junct-	0.076	 0.05	 0.08	  0.0	 96	 182	main 1
  -0.220666	  -0.521060	       4*	Junct	0.049	 0.03	 0.12	  0.1	 96	 180	main 1
  -0.220702	  -0.519478	      12*	Junct	0.176	 0.22	 0.30	  0.3	 48	  91	high street
  -0.220739	  -0.517804	      18*	Junct	0.186	 0.23	 0.49	  0.5	 48	  91	high street
  -0.220782	  -0.516137	      24*	Junct	0.185	 0.23	 0.67	  0.8	 48	  91	high street
  -0.220361	  -0.515961	      25*	Junct-	0.050	 0.06	 0.72	  0.8	 48	  22	dead-end 3
- -0.220019	  -0.515847	      26 	Waypt	0.040	 0.05	 0.76	  0.9	 48	  18	dead-end 3
+ -0.220019	  -0.515847	      26 	Waypt#2	0.040	 0.05	 0.76	  0.9	 48	  18	dead-end 3
  -0.220361	  -0.515961	      25*	Junct-	0.040	 0.05	 0.80	  0.9	 48	 198	dead-end 3
  -0.220782	  -0.516137	      24*	Junct	0.050	 0.06	 0.85	  1.0	 48	 202	dead-end 3
  -0.220817	  -0.514062	      32*	Junct	0.230	 0.29	 1.08	  1.3	 48	  90	high street
  -0.220344	  -0.514042	      33*	Junct-	0.052	 0.03	 1.13	  1.3	 96	   2	main 2
- -0.219539	  -0.514007	      -3 	Waypt	0.089	 0.06	 1.22	  1.4	 96	   2	main 2
+ -0.219539	  -0.514007	      -3 	Waypt#3	0.089	 0.06	 1.22	  1.4	 96	   2	main 2
diff --git a/src/test/expected/dead-ends-WP10.txt b/src/test/expected/dead-ends-WP10.txt
index b75124f..cced126 100644
--- a/src/test/expected/dead-ends-WP10.txt
+++ b/src/test/expected/dead-ends-WP10.txt
@@ -4,7 +4,7 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219535	  -0.521016	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219535	  -0.521016	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220223	  -0.521052	       5*	Junct-	0.076	 0.05	 0.08	  0.0	 96	 182	main 1
  -0.220666	  -0.521060	       4*	Junct	0.049	 0.03	 0.12	  0.1	 96	 180	main 1
  -0.220702	  -0.519478	      12*	Junct	0.176	 0.22	 0.30	  0.3	 48	  91	high street
@@ -12,10 +12,10 @@
  -0.220782	  -0.516137	      24*	Junct	0.185	 0.23	 0.67	  0.8	 48	  91	high street
  -0.220361	  -0.515961	      25*	Junct-	0.050	 0.06	 0.72	  0.8	 48	  22	dead-end 3
  -0.220019	  -0.515847	      26 	Inter	0.040	 0.05	 0.76	  0.9	 48	  18	dead-end 3
- -0.219672	  -0.516031	      -2 	Waypt	0.043	 0.05	 0.81	  0.9	 48	 332	dead-end 3
+ -0.219672	  -0.516031	      -2 	Waypt#2	0.043	 0.05	 0.81	  0.9	 48	 332	dead-end 3
  -0.220019	  -0.515847	      26 	Inter	0.043	 0.05	 0.85	  1.0	 48	 152	dead-end 3
  -0.220361	  -0.515961	      25*	Junct-	0.040	 0.05	 0.89	  1.0	 48	 198	dead-end 3
  -0.220782	  -0.516137	      24*	Junct	0.050	 0.06	 0.94	  1.1	 48	 202	dead-end 3
  -0.220817	  -0.514062	      32*	Junct	0.230	 0.29	 1.17	  1.4	 48	  90	high street
  -0.220344	  -0.514042	      33*	Junct-	0.052	 0.03	 1.22	  1.4	 96	   2	main 2
- -0.219539	  -0.514007	      -3 	Waypt	0.089	 0.06	 1.31	  1.5	 96	   2	main 2
+ -0.219539	  -0.514007	      -3 	Waypt#3	0.089	 0.06	 1.31	  1.5	 96	   2	main 2
diff --git a/src/test/expected/dead-ends-WP11.txt b/src/test/expected/dead-ends-WP11.txt
index 3cbc217..1a3942e 100644
--- a/src/test/expected/dead-ends-WP11.txt
+++ b/src/test/expected/dead-ends-WP11.txt
@@ -4,7 +4,7 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219535	  -0.521016	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219535	  -0.521016	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220223	  -0.521052	       5*	Junct-	0.076	 0.05	 0.08	  0.0	 96	 182	main 1
  -0.220666	  -0.521060	       4*	Junct	0.049	 0.03	 0.12	  0.1	 96	 180	main 1
  -0.220702	  -0.519478	      12*	Junct	0.176	 0.22	 0.30	  0.3	 48	  91	high street
@@ -13,11 +13,11 @@
  -0.220361	  -0.515961	      25*	Junct-	0.050	 0.06	 0.72	  0.8	 48	  22	dead-end 3
  -0.220019	  -0.515847	      26 	Inter	0.040	 0.05	 0.76	  0.9	 48	  18	dead-end 3
  -0.219341	  -0.516206	      23 	Inter	0.085	 0.10	 0.85	  1.0	 48	 332	dead-end 3
- -0.218493	  -0.515789	      27*	Waypt	0.105	 0.13	 0.95	  1.1	 48	  26	dead-end 3
+ -0.218493	  -0.515789	      27*	Waypt#2	0.105	 0.13	 0.95	  1.1	 48	  26	dead-end 3
  -0.219341	  -0.516206	      23 	Inter	0.105	 0.13	 1.06	  1.2	 48	 206	dead-end 3
  -0.220019	  -0.515847	      26 	Inter	0.085	 0.10	 1.14	  1.3	 48	 152	dead-end 3
  -0.220361	  -0.515961	      25*	Junct-	0.040	 0.05	 1.18	  1.4	 48	 198	dead-end 3
  -0.220782	  -0.516137	      24*	Junct	0.050	 0.06	 1.23	  1.5	 48	 202	dead-end 3
  -0.220817	  -0.514062	      32*	Junct	0.230	 0.29	 1.46	  1.7	 48	  90	high street
  -0.220344	  -0.514042	      33*	Junct-	0.052	 0.03	 1.51	  1.8	 96	   2	main 2
- -0.219539	  -0.514007	      -3 	Waypt	0.089	 0.06	 1.60	  1.8	 96	   2	main 2
+ -0.219539	  -0.514007	      -3 	Waypt#3	0.089	 0.06	 1.60	  1.8	 96	   2	main 2
diff --git a/src/test/expected/fake-node-with-loop-WP01.txt b/src/test/expected/fake-node-with-loop-WP01.txt
index 7ab2431..cc7bce2 100644
--- a/src/test/expected/fake-node-with-loop-WP01.txt
+++ b/src/test/expected/fake-node-with-loop-WP01.txt
@@ -4,9 +4,9 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.216904	  -0.520770	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.216904	  -0.520770	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.217286	  -0.520780	      10 	Junct-	0.042	 0.03	 0.04	  0.0	 96	 181	main 1
- -0.218086	  -0.520797	      -2 	Waypt	0.088	 0.06	 0.13	  0.1	 96	 181	main 1
+ -0.218086	  -0.520797	      -2 	Waypt#2	0.088	 0.06	 0.13	  0.1	 96	 181	main 1
  -0.218523	  -0.520806	       9 	Junct-	0.048	 0.03	 0.18	  0.1	 96	 181	main 1
  -0.219482	  -0.520837	       8*	Junct	0.106	 0.07	 0.28	  0.2	 96	 181	main 1
  -0.219692	  -0.520509	      14 	Junct-	0.043	 0.03	 0.33	  0.2	 96	 122	roundabout
@@ -16,4 +16,4 @@
  -0.219665	  -0.521190	       5 	Junct-	0.044	 0.03	 0.50	  0.3	 96	   1	roundabout
  -0.219482	  -0.520837	       8*	Junct	0.044	 0.03	 0.55	  0.3	 96	  62	roundabout
  -0.218523	  -0.520806	       9 	Junct-	0.106	 0.07	 0.65	  0.4	 96	   1	main 1
- -0.217741	  -0.520789	      -3 	Waypt	0.086	 0.05	 0.74	  0.5	 96	   1	main 1
+ -0.217741	  -0.520789	      -3 	Waypt#3	0.086	 0.05	 0.74	  0.5	 96	   1	main 1
diff --git a/src/test/expected/fake-node-with-loop-WP02.txt b/src/test/expected/fake-node-with-loop-WP02.txt
index 6c32260..27a006b 100644
--- a/src/test/expected/fake-node-with-loop-WP02.txt
+++ b/src/test/expected/fake-node-with-loop-WP02.txt
@@ -4,10 +4,10 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.216959	  -0.520771	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.216959	  -0.520771	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.217286	  -0.520780	      10 	Junct-	0.036	 0.02	 0.04	  0.0	 96	 181	main 1
  -0.218523	  -0.520806	       9 	Junct-	0.137	 0.09	 0.17	  0.1	 96	 181	main 1
- -0.219171	  -0.520827	      -2 	Waypt	0.071	 0.04	 0.24	  0.1	 96	 181	main 1
+ -0.219171	  -0.520827	      -2 	Waypt#2	0.071	 0.04	 0.24	  0.1	 96	 181	main 1
  -0.219482	  -0.520837	       8*	Junct	0.034	 0.02	 0.28	  0.2	 96	 181	main 1
  -0.219692	  -0.520509	      14 	Junct-	0.043	 0.03	 0.32	  0.2	 96	 122	roundabout
  -0.220082	  -0.520522	      13 	Junct-	0.043	 0.03	 0.36	  0.2	 96	 181	roundabout
@@ -15,4 +15,4 @@
  -0.220062	  -0.521204	       4 	Junct-	0.044	 0.03	 0.45	  0.3	 96	 301	roundabout
  -0.219665	  -0.521190	       5 	Junct-	0.044	 0.03	 0.49	  0.3	 96	   1	roundabout
  -0.219482	  -0.520837	       8*	Junct	0.044	 0.03	 0.54	  0.3	 96	  62	roundabout
- -0.218842	  -0.520816	      -3 	Waypt	0.070	 0.04	 0.61	  0.4	 96	   1	main 1
+ -0.218842	  -0.520816	      -3 	Waypt#3	0.070	 0.04	 0.61	  0.4	 96	   1	main 1
diff --git a/src/test/expected/loop-and-reverse-WP-L.txt b/src/test/expected/loop-and-reverse-WP-L.txt
new file mode 100644
index 0000000..2e0c302
--- /dev/null
+++ b/src/test/expected/loop-and-reverse-WP-L.txt
@@ -0,0 +1,14 @@
+# Creator : Routino - http://www.routino.org/
+# Source : Routino test cases - (c) Andrew M. Bishop
+# License : GNU Affero General Public License v3 or later
+#
+#Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
+#        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
+ -0.219526	  -0.521010	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
+ -0.220666	  -0.521060	       4*	Junct	0.126	 0.08	 0.13	  0.1	 96	 182	main 1
+ -0.220749	  -0.517228	      -2 	Waypt#2	0.426	 0.53	 0.55	  0.6	 48	  91	low street
+ -0.220817	  -0.514062	      14*	Junct	0.352	 0.44	 0.90	  1.1	 48	  91	low street
+ -0.219540	  -0.514010	      -3 	Waypt#3	0.141	 0.09	 1.04	  1.1	 96	   2	main 2
+ -0.218970	  -0.513986	      15*	Junct	0.063	 0.04	 1.11	  1.2	 96	   2	main 2
+ -0.218820	  -0.520980	       5*	Junct	0.778	 0.97	 1.89	  2.1	 48	 271	high street
+ -0.219526	  -0.521010	      -1 	Waypt#1	0.078	 0.05	 1.96	  2.2	 96	 182	main 1
diff --git a/src/test/expected/loop-and-reverse-WP-LR.txt b/src/test/expected/loop-and-reverse-WP-LR.txt
new file mode 100644
index 0000000..ff2cd48
--- /dev/null
+++ b/src/test/expected/loop-and-reverse-WP-LR.txt
@@ -0,0 +1,14 @@
+# Creator : Routino - http://www.routino.org/
+# Source : Routino test cases - (c) Andrew M. Bishop
+# License : GNU Affero General Public License v3 or later
+#
+#Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
+#        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
+ -0.219526	  -0.521010	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
+ -0.218820	  -0.520980	       5*	Junct	0.078	 0.05	 0.08	  0.0	 96	   2	main 1
+ -0.218970	  -0.513986	      15*	Junct	0.778	 0.97	 0.86	  1.0	 48	  91	high street
+ -0.219540	  -0.514010	      -3 	Waypt#3	0.063	 0.04	 0.92	  1.1	 96	 182	main 2
+ -0.220817	  -0.514062	      14*	Junct	0.141	 0.09	 1.06	  1.1	 96	 182	main 2
+ -0.220749	  -0.517228	      -2 	Waypt#2	0.352	 0.44	 1.41	  1.6	 48	 271	low street
+ -0.220666	  -0.521060	       4*	Junct	0.426	 0.53	 1.84	  2.1	 48	 271	low street
+ -0.219526	  -0.521010	      -1 	Waypt#1	0.126	 0.08	 1.96	  2.2	 96	   2	main 1
diff --git a/src/test/expected/loop-and-reverse-WP-R.txt b/src/test/expected/loop-and-reverse-WP-R.txt
new file mode 100644
index 0000000..8327c5a
--- /dev/null
+++ b/src/test/expected/loop-and-reverse-WP-R.txt
@@ -0,0 +1,11 @@
+# Creator : Routino - http://www.routino.org/
+# Source : Routino test cases - (c) Andrew M. Bishop
+# License : GNU Affero General Public License v3 or later
+#
+#Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
+#        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
+ -0.219540	  -0.514010	      -3 	Waypt#3	0.000	 0.00	 0.00	  0.0			
+ -0.220817	  -0.514062	      14*	Junct	0.141	 0.09	 0.14	  0.1	 96	 182	main 2
+ -0.220749	  -0.517228	      -2 	Waypt#2	0.352	 0.44	 0.49	  0.5	 48	 271	low street
+ -0.220666	  -0.521060	       4*	Junct	0.426	 0.53	 0.92	  1.1	 48	 271	low street
+ -0.219526	  -0.521010	      -1 	Waypt#1	0.126	 0.08	 1.04	  1.1	 96	   2	main 1
diff --git a/src/test/expected/loop-and-reverse-WP.txt b/src/test/expected/loop-and-reverse-WP.txt
new file mode 100644
index 0000000..a720c1a
--- /dev/null
+++ b/src/test/expected/loop-and-reverse-WP.txt
@@ -0,0 +1,11 @@
+# Creator : Routino - http://www.routino.org/
+# Source : Routino test cases - (c) Andrew M. Bishop
+# License : GNU Affero General Public License v3 or later
+#
+#Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
+#        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
+ -0.219526	  -0.521010	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
+ -0.220666	  -0.521060	       4*	Junct	0.126	 0.08	 0.13	  0.1	 96	 182	main 1
+ -0.220749	  -0.517228	      -2 	Waypt#2	0.426	 0.53	 0.55	  0.6	 48	  91	low street
+ -0.220817	  -0.514062	      14*	Junct	0.352	 0.44	 0.90	  1.1	 48	  91	low street
+ -0.219540	  -0.514010	      -3 	Waypt#3	0.141	 0.09	 1.04	  1.1	 96	   2	main 2
diff --git a/src/test/expected/loops-WP01.txt b/src/test/expected/loops-WP01.txt
index 06ab275..650a4ca 100644
--- a/src/test/expected/loops-WP01.txt
+++ b/src/test/expected/loops-WP01.txt
@@ -4,11 +4,11 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219562	  -0.520851	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219562	  -0.520851	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220223	  -0.520885	       5*	Junct-	0.073	 0.04	 0.07	  0.0	 96	 182	main 1
  -0.220666	  -0.520893	       4*	Junct	0.049	 0.03	 0.12	  0.1	 96	 181	main 1
  -0.220695	  -0.519489	      11*	Junct	0.156	 0.20	 0.28	  0.3	 48	  91	high street
- -0.220280	  -0.519256	      15*	Waypt	0.052	 0.07	 0.33	  0.3	 48	  29	loop 1
+ -0.220280	  -0.519256	      15*	Waypt#2	0.052	 0.07	 0.33	  0.3	 48	  29	loop 1
  -0.219910	  -0.519112	      17 	Inter	0.044	 0.06	 0.37	  0.4	 48	  21	loop 1
  -0.219237	  -0.519286	      13*	Junct	0.077	 0.10	 0.45	  0.5	 48	 345	loop 1
  -0.218764	  -0.519471	      12 	Inter	0.056	 0.07	 0.51	  0.6	 48	 338	loop 1
@@ -21,4 +21,4 @@
  -0.220739	  -0.517801	      19*	Junct	0.187	 0.23	 1.05	  1.2	 48	  91	high street
  -0.220784	  -0.516035	      30*	Junct	0.196	 0.24	 1.25	  1.5	 48	  91	high street
  -0.220311	  -0.516015	      31*	Junct-	0.052	 0.03	 1.30	  1.5	 96	   2	main 2
- -0.219596	  -0.515984	      -3 	Waypt	0.079	 0.05	 1.38	  1.6	 96	   2	main 2
+ -0.219596	  -0.515984	      -3 	Waypt#3	0.079	 0.05	 1.38	  1.6	 96	   2	main 2
diff --git a/src/test/expected/loops-WP02.txt b/src/test/expected/loops-WP02.txt
index 2564227..3d7a6a5 100644
--- a/src/test/expected/loops-WP02.txt
+++ b/src/test/expected/loops-WP02.txt
@@ -4,12 +4,12 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219562	  -0.520851	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219562	  -0.520851	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220223	  -0.520885	       5*	Junct-	0.073	 0.04	 0.07	  0.0	 96	 182	main 1
  -0.220666	  -0.520893	       4*	Junct	0.049	 0.03	 0.12	  0.1	 96	 181	main 1
  -0.220695	  -0.519489	      11*	Junct	0.156	 0.20	 0.28	  0.3	 48	  91	high street
  -0.220280	  -0.519256	      15*	Junct-	0.052	 0.07	 0.33	  0.3	 48	  29	loop 1
- -0.219910	  -0.519112	      17 	Waypt	0.044	 0.06	 0.37	  0.4	 48	  21	loop 1
+ -0.219910	  -0.519112	      17 	Waypt#2	0.044	 0.06	 0.37	  0.4	 48	  21	loop 1
  -0.219237	  -0.519286	      13*	Junct	0.077	 0.10	 0.45	  0.5	 48	 345	loop 1
  -0.218764	  -0.519471	      12 	Inter	0.056	 0.07	 0.51	  0.6	 48	 338	loop 1
  -0.218380	  -0.519134	      16 	Inter	0.056	 0.07	 0.56	  0.6	 48	  41	loop 1
@@ -21,4 +21,4 @@
  -0.220739	  -0.517801	      19*	Junct	0.187	 0.23	 1.05	  1.2	 48	  91	high street
  -0.220784	  -0.516035	      30*	Junct	0.196	 0.24	 1.25	  1.5	 48	  91	high street
  -0.220311	  -0.516015	      31*	Junct-	0.052	 0.03	 1.30	  1.5	 96	   2	main 2
- -0.219596	  -0.515984	      -3 	Waypt	0.079	 0.05	 1.38	  1.6	 96	   2	main 2
+ -0.219596	  -0.515984	      -3 	Waypt#3	0.079	 0.05	 1.38	  1.6	 96	   2	main 2
diff --git a/src/test/expected/loops-WP03.txt b/src/test/expected/loops-WP03.txt
index c58ac3f..51bf483 100644
--- a/src/test/expected/loops-WP03.txt
+++ b/src/test/expected/loops-WP03.txt
@@ -4,13 +4,13 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219562	  -0.520851	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219562	  -0.520851	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220223	  -0.520885	       5*	Junct-	0.073	 0.04	 0.07	  0.0	 96	 182	main 1
  -0.220666	  -0.520893	       4*	Junct	0.049	 0.03	 0.12	  0.1	 96	 181	main 1
  -0.220695	  -0.519489	      11*	Junct	0.156	 0.20	 0.28	  0.3	 48	  91	high street
  -0.220280	  -0.519256	      15*	Junct-	0.052	 0.07	 0.33	  0.3	 48	  29	loop 1
  -0.219910	  -0.519112	      17 	Inter	0.044	 0.06	 0.37	  0.4	 48	  21	loop 1
- -0.219578	  -0.519198	      -2 	Waypt	0.038	 0.05	 0.41	  0.4	 48	 345	loop 1
+ -0.219578	  -0.519198	      -2 	Waypt#2	0.038	 0.05	 0.41	  0.4	 48	 345	loop 1
  -0.219237	  -0.519286	      13*	Junct	0.039	 0.05	 0.45	  0.5	 48	 345	loop 1
  -0.218764	  -0.519471	      12 	Inter	0.056	 0.07	 0.51	  0.6	 48	 338	loop 1
  -0.218380	  -0.519134	      16 	Inter	0.056	 0.07	 0.56	  0.6	 48	  41	loop 1
@@ -22,4 +22,4 @@
  -0.220739	  -0.517801	      19*	Junct	0.187	 0.23	 1.05	  1.2	 48	  91	high street
  -0.220784	  -0.516035	      30*	Junct	0.196	 0.24	 1.25	  1.5	 48	  91	high street
  -0.220311	  -0.516015	      31*	Junct-	0.052	 0.03	 1.30	  1.5	 96	   2	main 2
- -0.219596	  -0.515984	      -3 	Waypt	0.079	 0.05	 1.38	  1.6	 96	   2	main 2
+ -0.219596	  -0.515984	      -3 	Waypt#3	0.079	 0.05	 1.38	  1.6	 96	   2	main 2
diff --git a/src/test/expected/loops-WP04.txt b/src/test/expected/loops-WP04.txt
index 078e769..141331c 100644
--- a/src/test/expected/loops-WP04.txt
+++ b/src/test/expected/loops-WP04.txt
@@ -4,14 +4,14 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219562	  -0.520851	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219562	  -0.520851	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220223	  -0.520885	       5*	Junct-	0.073	 0.04	 0.07	  0.0	 96	 182	main 1
  -0.220666	  -0.520893	       4*	Junct	0.049	 0.03	 0.12	  0.1	 96	 181	main 1
  -0.220695	  -0.519489	      11*	Junct	0.156	 0.20	 0.28	  0.3	 48	  91	high street
  -0.220280	  -0.519256	      15*	Junct-	0.052	 0.07	 0.33	  0.3	 48	  29	loop 1
  -0.219910	  -0.519112	      17 	Inter	0.044	 0.06	 0.37	  0.4	 48	  21	loop 1
  -0.219237	  -0.519286	      13*	Junct	0.077	 0.10	 0.45	  0.5	 48	 345	loop 1
- -0.218997	  -0.519053	      -2 	Waypt	0.037	 0.04	 0.49	  0.5	 48	  44	loop 1
+ -0.218997	  -0.519053	      -2 	Waypt#2	0.037	 0.04	 0.49	  0.5	 48	  44	loop 1
  -0.218776	  -0.518838	      18 	Inter	0.034	 0.04	 0.52	  0.6	 48	  44	loop 1
  -0.218380	  -0.519134	      16 	Inter	0.055	 0.07	 0.58	  0.6	 48	 323	loop 1
  -0.218764	  -0.519471	      12 	Inter	0.056	 0.07	 0.63	  0.7	 48	 221	loop 1
@@ -22,4 +22,4 @@
  -0.220739	  -0.517801	      19*	Junct	0.187	 0.23	 1.05	  1.2	 48	  91	high street
  -0.220784	  -0.516035	      30*	Junct	0.196	 0.24	 1.25	  1.5	 48	  91	high street
  -0.220311	  -0.516015	      31*	Junct-	0.052	 0.03	 1.30	  1.5	 96	   2	main 2
- -0.219596	  -0.515984	      -3 	Waypt	0.079	 0.05	 1.38	  1.6	 96	   2	main 2
+ -0.219596	  -0.515984	      -3 	Waypt#3	0.079	 0.05	 1.38	  1.6	 96	   2	main 2
diff --git a/src/test/expected/loops-WP05.txt b/src/test/expected/loops-WP05.txt
index d959214..f75d1e4 100644
--- a/src/test/expected/loops-WP05.txt
+++ b/src/test/expected/loops-WP05.txt
@@ -4,7 +4,7 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219562	  -0.520851	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219562	  -0.520851	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220223	  -0.520885	       5*	Junct-	0.073	 0.04	 0.07	  0.0	 96	 182	main 1
  -0.220666	  -0.520893	       4*	Junct	0.049	 0.03	 0.12	  0.1	 96	 181	main 1
  -0.220695	  -0.519489	      11*	Junct	0.156	 0.20	 0.28	  0.3	 48	  91	high street
@@ -12,7 +12,7 @@
  -0.219910	  -0.519112	      17 	Inter	0.044	 0.06	 0.37	  0.4	 48	  21	loop 1
  -0.219237	  -0.519286	      13*	Junct	0.077	 0.10	 0.45	  0.5	 48	 345	loop 1
  -0.218764	  -0.519471	      12 	Inter	0.056	 0.07	 0.51	  0.6	 48	 338	loop 1
- -0.218380	  -0.519134	      16 	Waypt	0.056	 0.07	 0.56	  0.6	 48	  41	loop 1
+ -0.218380	  -0.519134	      16 	Waypt#2	0.056	 0.07	 0.56	  0.6	 48	  41	loop 1
  -0.218776	  -0.518838	      18 	Inter	0.055	 0.07	 0.62	  0.7	 48	 143	loop 1
  -0.219237	  -0.519286	      13*	Junct	0.071	 0.09	 0.69	  0.8	 48	 224	loop 1
  -0.219910	  -0.519112	      17 	Inter	0.077	 0.10	 0.77	  0.9	 48	 165	loop 1
@@ -21,4 +21,4 @@
  -0.220739	  -0.517801	      19*	Junct	0.187	 0.23	 1.05	  1.2	 48	  91	high street
  -0.220784	  -0.516035	      30*	Junct	0.196	 0.24	 1.25	  1.5	 48	  91	high street
  -0.220311	  -0.516015	      31*	Junct-	0.052	 0.03	 1.30	  1.5	 96	   2	main 2
- -0.219596	  -0.515984	      -3 	Waypt	0.079	 0.05	 1.38	  1.6	 96	   2	main 2
+ -0.219596	  -0.515984	      -3 	Waypt#3	0.079	 0.05	 1.38	  1.6	 96	   2	main 2
diff --git a/src/test/expected/loops-WP06.txt b/src/test/expected/loops-WP06.txt
index 8310598..b2ffd9f 100644
--- a/src/test/expected/loops-WP06.txt
+++ b/src/test/expected/loops-WP06.txt
@@ -4,12 +4,12 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219562	  -0.520851	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219562	  -0.520851	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220223	  -0.520885	       5*	Junct-	0.073	 0.04	 0.07	  0.0	 96	 182	main 1
  -0.220666	  -0.520893	       4*	Junct	0.049	 0.03	 0.12	  0.1	 96	 181	main 1
  -0.220695	  -0.519489	      11*	Junct	0.156	 0.20	 0.28	  0.3	 48	  91	high street
  -0.220739	  -0.517801	      19*	Junct	0.187	 0.23	 0.47	  0.5	 48	  91	high street
- -0.220301	  -0.517576	      22*	Waypt	0.054	 0.07	 0.52	  0.6	 48	  27	loop 2
+ -0.220301	  -0.517576	      22*	Waypt#2	0.054	 0.07	 0.52	  0.6	 48	  27	loop 2
  -0.219946	  -0.517397	      24 	Inter	0.044	 0.06	 0.56	  0.6	 48	  26	loop 2
  -0.219266	  -0.517579	      21*	Junct	0.078	 0.10	 0.64	  0.7	 48	 345	loop 2
  -0.218794	  -0.517763	      20 	Inter	0.056	 0.07	 0.70	  0.8	 48	 338	loop 2
@@ -21,4 +21,4 @@
  -0.220739	  -0.517801	      19*	Junct	0.054	 0.07	 1.05	  1.2	 48	 207	loop 2
  -0.220784	  -0.516035	      30*	Junct	0.196	 0.24	 1.25	  1.5	 48	  91	high street
  -0.220311	  -0.516015	      31*	Junct-	0.052	 0.03	 1.30	  1.5	 96	   2	main 2
- -0.219596	  -0.515984	      -3 	Waypt	0.079	 0.05	 1.38	  1.6	 96	   2	main 2
+ -0.219596	  -0.515984	      -3 	Waypt#3	0.079	 0.05	 1.38	  1.6	 96	   2	main 2
diff --git a/src/test/expected/loops-WP07.txt b/src/test/expected/loops-WP07.txt
index 5bc2e8a..14cb0ad 100644
--- a/src/test/expected/loops-WP07.txt
+++ b/src/test/expected/loops-WP07.txt
@@ -4,13 +4,13 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219562	  -0.520851	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219562	  -0.520851	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220223	  -0.520885	       5*	Junct-	0.073	 0.04	 0.07	  0.0	 96	 182	main 1
  -0.220666	  -0.520893	       4*	Junct	0.049	 0.03	 0.12	  0.1	 96	 181	main 1
  -0.220695	  -0.519489	      11*	Junct	0.156	 0.20	 0.28	  0.3	 48	  91	high street
  -0.220739	  -0.517801	      19*	Junct	0.187	 0.23	 0.47	  0.5	 48	  91	high street
  -0.220301	  -0.517576	      22*	Junct-	0.054	 0.07	 0.52	  0.6	 48	  27	loop 2
- -0.219946	  -0.517397	      24 	Waypt	0.044	 0.06	 0.56	  0.6	 48	  26	loop 2
+ -0.219946	  -0.517397	      24 	Waypt#2	0.044	 0.06	 0.56	  0.6	 48	  26	loop 2
  -0.219266	  -0.517579	      21*	Junct	0.078	 0.10	 0.64	  0.7	 48	 345	loop 2
  -0.218794	  -0.517763	      20 	Inter	0.056	 0.07	 0.70	  0.8	 48	 338	loop 2
  -0.218417	  -0.517462	      23*	Junct-	0.053	 0.07	 0.75	  0.9	 48	  38	loop 2
@@ -21,4 +21,4 @@
  -0.220739	  -0.517801	      19*	Junct	0.054	 0.07	 1.05	  1.2	 48	 207	loop 2
  -0.220784	  -0.516035	      30*	Junct	0.196	 0.24	 1.25	  1.5	 48	  91	high street
  -0.220311	  -0.516015	      31*	Junct-	0.052	 0.03	 1.30	  1.5	 96	   2	main 2
- -0.219596	  -0.515984	      -3 	Waypt	0.079	 0.05	 1.38	  1.6	 96	   2	main 2
+ -0.219596	  -0.515984	      -3 	Waypt#3	0.079	 0.05	 1.38	  1.6	 96	   2	main 2
diff --git a/src/test/expected/loops-WP08.txt b/src/test/expected/loops-WP08.txt
index eed204d..84127c3 100644
--- a/src/test/expected/loops-WP08.txt
+++ b/src/test/expected/loops-WP08.txt
@@ -4,14 +4,14 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219562	  -0.520851	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219562	  -0.520851	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220223	  -0.520885	       5*	Junct-	0.073	 0.04	 0.07	  0.0	 96	 182	main 1
  -0.220666	  -0.520893	       4*	Junct	0.049	 0.03	 0.12	  0.1	 96	 181	main 1
  -0.220695	  -0.519489	      11*	Junct	0.156	 0.20	 0.28	  0.3	 48	  91	high street
  -0.220739	  -0.517801	      19*	Junct	0.187	 0.23	 0.47	  0.5	 48	  91	high street
  -0.220301	  -0.517576	      22*	Junct-	0.054	 0.07	 0.52	  0.6	 48	  27	loop 2
  -0.219946	  -0.517397	      24 	Inter	0.044	 0.06	 0.56	  0.6	 48	  26	loop 2
- -0.219597	  -0.517490	      -2 	Waypt	0.040	 0.05	 0.60	  0.7	 48	 345	loop 2
+ -0.219597	  -0.517490	      -2 	Waypt#2	0.040	 0.05	 0.60	  0.7	 48	 345	loop 2
  -0.219266	  -0.517579	      21*	Junct	0.038	 0.05	 0.64	  0.7	 48	 345	loop 2
  -0.218794	  -0.517763	      20 	Inter	0.056	 0.07	 0.70	  0.8	 48	 338	loop 2
  -0.218417	  -0.517462	      23*	Junct-	0.053	 0.07	 0.75	  0.9	 48	  38	loop 2
@@ -22,4 +22,4 @@
  -0.220739	  -0.517801	      19*	Junct	0.054	 0.07	 1.05	  1.2	 48	 207	loop 2
  -0.220784	  -0.516035	      30*	Junct	0.196	 0.24	 1.25	  1.5	 48	  91	high street
  -0.220311	  -0.516015	      31*	Junct-	0.052	 0.03	 1.30	  1.5	 96	   2	main 2
- -0.219596	  -0.515984	      -3 	Waypt	0.079	 0.05	 1.38	  1.6	 96	   2	main 2
+ -0.219596	  -0.515984	      -3 	Waypt#3	0.079	 0.05	 1.38	  1.6	 96	   2	main 2
diff --git a/src/test/expected/loops-WP09.txt b/src/test/expected/loops-WP09.txt
index d7b8fde..ece11a8 100644
--- a/src/test/expected/loops-WP09.txt
+++ b/src/test/expected/loops-WP09.txt
@@ -4,7 +4,7 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219562	  -0.520851	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219562	  -0.520851	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220223	  -0.520885	       5*	Junct-	0.073	 0.04	 0.07	  0.0	 96	 182	main 1
  -0.220666	  -0.520893	       4*	Junct	0.049	 0.03	 0.12	  0.1	 96	 181	main 1
  -0.220695	  -0.519489	      11*	Junct	0.156	 0.20	 0.28	  0.3	 48	  91	high street
@@ -12,7 +12,7 @@
  -0.220301	  -0.517576	      22*	Junct-	0.054	 0.07	 0.52	  0.6	 48	  27	loop 2
  -0.219946	  -0.517397	      24 	Inter	0.044	 0.06	 0.56	  0.6	 48	  26	loop 2
  -0.219266	  -0.517579	      21*	Junct	0.078	 0.10	 0.64	  0.7	 48	 345	loop 2
- -0.219013	  -0.517333	      -2 	Waypt	0.039	 0.05	 0.68	  0.8	 48	  44	loop 2
+ -0.219013	  -0.517333	      -2 	Waypt#2	0.039	 0.05	 0.68	  0.8	 48	  44	loop 2
  -0.218805	  -0.517131	      25 	Inter	0.032	 0.04	 0.71	  0.8	 48	  44	loop 2
  -0.218417	  -0.517462	      23*	Junct-	0.056	 0.07	 0.77	  0.9	 48	 319	loop 2
  -0.218794	  -0.517763	      20 	Inter	0.053	 0.07	 0.82	  0.9	 48	 218	loop 2
@@ -22,4 +22,4 @@
  -0.220739	  -0.517801	      19*	Junct	0.054	 0.07	 1.05	  1.2	 48	 207	loop 2
  -0.220784	  -0.516035	      30*	Junct	0.196	 0.24	 1.25	  1.5	 48	  91	high street
  -0.220311	  -0.516015	      31*	Junct-	0.052	 0.03	 1.30	  1.5	 96	   2	main 2
- -0.219596	  -0.515984	      -3 	Waypt	0.079	 0.05	 1.38	  1.6	 96	   2	main 2
+ -0.219596	  -0.515984	      -3 	Waypt#3	0.079	 0.05	 1.38	  1.6	 96	   2	main 2
diff --git a/src/test/expected/loops-WP10.txt b/src/test/expected/loops-WP10.txt
index 1cd80bd..f05db36 100644
--- a/src/test/expected/loops-WP10.txt
+++ b/src/test/expected/loops-WP10.txt
@@ -4,7 +4,7 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219562	  -0.520851	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219562	  -0.520851	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220223	  -0.520885	       5*	Junct-	0.073	 0.04	 0.07	  0.0	 96	 182	main 1
  -0.220666	  -0.520893	       4*	Junct	0.049	 0.03	 0.12	  0.1	 96	 181	main 1
  -0.220695	  -0.519489	      11*	Junct	0.156	 0.20	 0.28	  0.3	 48	  91	high street
@@ -12,7 +12,7 @@
  -0.220301	  -0.517576	      22*	Junct-	0.054	 0.07	 0.52	  0.6	 48	  27	loop 2
  -0.219946	  -0.517397	      24 	Inter	0.044	 0.06	 0.56	  0.6	 48	  26	loop 2
  -0.219266	  -0.517579	      21*	Junct	0.078	 0.10	 0.64	  0.7	 48	 345	loop 2
- -0.218805	  -0.517131	      25 	Waypt	0.071	 0.09	 0.71	  0.8	 48	  44	loop 2
+ -0.218805	  -0.517131	      25 	Waypt#2	0.071	 0.09	 0.71	  0.8	 48	  44	loop 2
  -0.218417	  -0.517462	      23*	Junct-	0.056	 0.07	 0.77	  0.9	 48	 319	loop 2
  -0.218794	  -0.517763	      20 	Inter	0.053	 0.07	 0.82	  0.9	 48	 218	loop 2
  -0.219266	  -0.517579	      21*	Junct	0.056	 0.07	 0.88	  1.0	 48	 158	loop 2
@@ -21,4 +21,4 @@
  -0.220739	  -0.517801	      19*	Junct	0.054	 0.07	 1.05	  1.2	 48	 207	loop 2
  -0.220784	  -0.516035	      30*	Junct	0.196	 0.24	 1.25	  1.5	 48	  91	high street
  -0.220311	  -0.516015	      31*	Junct-	0.052	 0.03	 1.30	  1.5	 96	   2	main 2
- -0.219596	  -0.515984	      -3 	Waypt	0.079	 0.05	 1.38	  1.6	 96	   2	main 2
+ -0.219596	  -0.515984	      -3 	Waypt#3	0.079	 0.05	 1.38	  1.6	 96	   2	main 2
diff --git a/src/test/expected/loops-WP11.txt b/src/test/expected/loops-WP11.txt
index f73fb5f..942b37e 100644
--- a/src/test/expected/loops-WP11.txt
+++ b/src/test/expected/loops-WP11.txt
@@ -4,7 +4,7 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219562	  -0.520851	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219562	  -0.520851	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220223	  -0.520885	       5*	Junct-	0.073	 0.04	 0.07	  0.0	 96	 182	main 1
  -0.220666	  -0.520893	       4*	Junct	0.049	 0.03	 0.12	  0.1	 96	 181	main 1
  -0.220695	  -0.519489	      11*	Junct	0.156	 0.20	 0.28	  0.3	 48	  91	high street
@@ -13,7 +13,7 @@
  -0.219946	  -0.517397	      24 	Inter	0.044	 0.06	 0.56	  0.6	 48	  26	loop 2
  -0.219266	  -0.517579	      21*	Junct	0.078	 0.10	 0.64	  0.7	 48	 345	loop 2
  -0.218794	  -0.517763	      20 	Inter	0.056	 0.07	 0.70	  0.8	 48	 338	loop 2
- -0.218417	  -0.517462	      23*	Waypt	0.053	 0.07	 0.75	  0.9	 48	  38	loop 2
+ -0.218417	  -0.517462	      23*	Waypt#2	0.053	 0.07	 0.75	  0.9	 48	  38	loop 2
  -0.218805	  -0.517131	      25 	Inter	0.056	 0.07	 0.81	  0.9	 48	 139	loop 2
  -0.219266	  -0.517579	      21*	Junct	0.071	 0.09	 0.88	  1.0	 48	 224	loop 2
  -0.219946	  -0.517397	      24 	Inter	0.078	 0.10	 0.95	  1.1	 48	 165	loop 2
@@ -21,4 +21,4 @@
  -0.220739	  -0.517801	      19*	Junct	0.054	 0.07	 1.05	  1.2	 48	 207	loop 2
  -0.220784	  -0.516035	      30*	Junct	0.196	 0.24	 1.25	  1.5	 48	  91	high street
  -0.220311	  -0.516015	      31*	Junct-	0.052	 0.03	 1.30	  1.5	 96	   2	main 2
- -0.219596	  -0.515984	      -3 	Waypt	0.079	 0.05	 1.38	  1.6	 96	   2	main 2
+ -0.219596	  -0.515984	      -3 	Waypt#3	0.079	 0.05	 1.38	  1.6	 96	   2	main 2
diff --git a/src/test/expected/no-super-WP01.txt b/src/test/expected/no-super-WP01.txt
index e4ca14f..7b03b8f 100644
--- a/src/test/expected/no-super-WP01.txt
+++ b/src/test/expected/no-super-WP01.txt
@@ -4,13 +4,13 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.215814	  -0.519419	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.215814	  -0.519419	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.215737	  -0.519035	       7 	Inter	0.043	 0.05	 0.04	  0.1	 48	  78	road1
  -0.215935	  -0.518253	      10 	Inter	0.089	 0.11	 0.13	  0.2	 48	 104	road1
  -0.215772	  -0.517713	      13 	Inter	0.062	 0.08	 0.19	  0.2	 48	  73	road1
  -0.215952	  -0.516838	      15 	Inter	0.099	 0.12	 0.29	  0.4	 48	 101	road1
  -0.215755	  -0.515945	      19 	Inter	0.101	 0.12	 0.39	  0.5	 48	  77	road1
- -0.215897	  -0.515462	      -2 	Waypt	0.055	 0.07	 0.45	  0.6	 48	 106	road1
+ -0.215897	  -0.515462	      -2 	Waypt#2	0.055	 0.07	 0.45	  0.6	 48	 106	road1
  -0.215755	  -0.515945	      19 	Inter	0.055	 0.07	 0.50	  0.6	 48	 286	road1
  -0.215952	  -0.516838	      15 	Inter	0.101	 0.12	 0.60	  0.8	 48	 257	road1
- -0.215868	  -0.517244	      -3 	Waypt	0.046	 0.06	 0.65	  0.8	 48	 281	road1
+ -0.215868	  -0.517244	      -3 	Waypt#3	0.046	 0.06	 0.65	  0.8	 48	 281	road1
diff --git a/src/test/expected/no-super-WP02.txt b/src/test/expected/no-super-WP02.txt
index fa321e3..ee08817 100644
--- a/src/test/expected/no-super-WP02.txt
+++ b/src/test/expected/no-super-WP02.txt
@@ -4,6 +4,6 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.216472	  -0.519026	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
- -0.216671	  -0.515660	      -2 	Waypt	0.374	 0.47	 0.37	  0.5	 48	  93	road2
- -0.216579	  -0.517212	      -3 	Waypt	0.172	 0.21	 0.55	  0.7	 48	 273	road2
+ -0.216472	  -0.519026	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
+ -0.216671	  -0.515660	      -2 	Waypt#2	0.374	 0.47	 0.37	  0.5	 48	  93	road2
+ -0.216579	  -0.517212	      -3 	Waypt#3	0.172	 0.21	 0.55	  0.7	 48	 273	road2
diff --git a/src/test/expected/no-super-WP03.txt b/src/test/expected/no-super-WP03.txt
index e0630c4..1adba42 100644
--- a/src/test/expected/no-super-WP03.txt
+++ b/src/test/expected/no-super-WP03.txt
@@ -4,10 +4,10 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.217185	  -0.519054	       5 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.217185	  -0.519054	       5 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.217382	  -0.518273	       8 	Inter	0.089	 0.11	 0.09	  0.1	 48	 104	road3
  -0.217219	  -0.517733	      11 	Inter	0.062	 0.08	 0.15	  0.2	 48	  73	road3
  -0.217399	  -0.516857	      14 	Inter	0.099	 0.12	 0.25	  0.3	 48	 101	road3
- -0.217202	  -0.515964	      17 	Waypt	0.101	 0.12	 0.35	  0.4	 48	  77	road3
+ -0.217202	  -0.515964	      17 	Waypt#2	0.101	 0.12	 0.35	  0.4	 48	  77	road3
  -0.217399	  -0.516857	      14 	Inter	0.101	 0.12	 0.45	  0.6	 48	 257	road3
- -0.217219	  -0.517733	      11 	Waypt	0.099	 0.12	 0.55	  0.7	 48	 281	road3
+ -0.217219	  -0.517733	      11 	Waypt#3	0.099	 0.12	 0.55	  0.7	 48	 281	road3
diff --git a/src/test/expected/no-super-WP04.txt b/src/test/expected/no-super-WP04.txt
index 901aced..e10666c 100644
--- a/src/test/expected/no-super-WP04.txt
+++ b/src/test/expected/no-super-WP04.txt
@@ -4,14 +4,14 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.217903	  -0.519035	       6 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.217903	  -0.519035	       6 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.218100	  -0.518253	       9 	Inter	0.089	 0.11	 0.09	  0.1	 48	 104	road4
  -0.217937	  -0.517713	      12 	Inter	0.062	 0.08	 0.15	  0.2	 48	  73	road4
  -0.218117	  -0.516837	      16 	Inter	0.099	 0.12	 0.25	  0.3	 48	 101	road4
  -0.217920	  -0.515945	      18 	Inter	0.101	 0.12	 0.35	  0.4	 48	  77	road4
  -0.218143	  -0.515189	      21 	Inter	0.087	 0.11	 0.44	  0.5	 48	 106	road4
- -0.217911	  -0.514640	      26 	Waypt	0.066	 0.08	 0.50	  0.6	 48	  67	road4
+ -0.217911	  -0.514640	      26 	Waypt#2	0.066	 0.08	 0.50	  0.6	 48	  67	road4
  -0.218143	  -0.515189	      21 	Inter	0.066	 0.08	 0.57	  0.7	 48	 247	road4
  -0.217920	  -0.515945	      18 	Inter	0.087	 0.11	 0.66	  0.8	 48	 286	road4
  -0.218117	  -0.516837	      16 	Inter	0.101	 0.12	 0.76	  0.9	 48	 257	road4
- -0.217937	  -0.517713	      12 	Waypt	0.099	 0.12	 0.86	  1.1	 48	 281	road4
+ -0.217937	  -0.517713	      12 	Waypt#3	0.099	 0.12	 0.86	  1.1	 48	 281	road4
diff --git a/src/test/expected/node-restrictions-WP01.txt b/src/test/expected/node-restrictions-WP01.txt
index 48b600b..3993eb5 100644
--- a/src/test/expected/node-restrictions-WP01.txt
+++ b/src/test/expected/node-restrictions-WP01.txt
@@ -4,12 +4,12 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219564	  -0.520846	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219564	  -0.520846	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220666	  -0.520893	       4*	Junct	0.122	 0.07	 0.12	  0.1	 96	 182	main 1
  -0.220682	  -0.520141	       9*	Junct	0.083	 0.08	 0.20	  0.2	 64	  91	high street
  -0.220695	  -0.519489	      12*	Change	0.072	 0.07	 0.28	  0.2	 64	  91	high street
  -0.221123	  -0.519360	      13 	Inter	0.049	 0.06	 0.33	  0.3	 48	 163	somepass road
- -0.221156	  -0.518615	      19*	Waypt	0.082	 0.10	 0.41	  0.4	 48	  92	somepass road
+ -0.221156	  -0.518615	      19*	Waypt#2	0.082	 0.10	 0.41	  0.4	 48	  92	somepass road
  -0.221123	  -0.519360	      13 	Inter	0.082	 0.10	 0.49	  0.5	 48	 272	somepass road
  -0.220695	  -0.519489	      12*	Junct	0.049	 0.06	 0.54	  0.5	 48	 343	somepass road
  -0.220694	  -0.519227	      15 	Inter	0.029	 0.04	 0.57	  0.6	 48	  89	long road
@@ -21,4 +21,4 @@
  -0.220746	  -0.518070	      23 	Inter	0.037	 0.04	 0.90	  1.0	 48	 149	long road
  -0.220739	  -0.517801	      26*	Junct	0.029	 0.04	 0.93	  1.0	 48	  88	long road
  -0.220784	  -0.516035	      31*	Junct	0.196	 0.18	 1.12	  1.2	 64	  91	high street
- -0.219593	  -0.515985	      -3 	Waypt	0.132	 0.08	 1.25	  1.3	 96	   2	main 2
+ -0.219593	  -0.515985	      -3 	Waypt#3	0.132	 0.08	 1.25	  1.3	 96	   2	main 2
diff --git a/src/test/expected/node-restrictions-WP02.txt b/src/test/expected/node-restrictions-WP02.txt
index 266baec..b298edc 100644
--- a/src/test/expected/node-restrictions-WP02.txt
+++ b/src/test/expected/node-restrictions-WP02.txt
@@ -4,12 +4,12 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219564	  -0.520846	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219564	  -0.520846	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220666	  -0.520893	       4*	Junct	0.122	 0.07	 0.12	  0.1	 96	 182	main 1
  -0.220682	  -0.520141	       9*	Junct	0.083	 0.08	 0.20	  0.2	 64	  91	high street
  -0.220695	  -0.519489	      12*	Change	0.072	 0.07	 0.28	  0.2	 64	  91	high street
  -0.221123	  -0.519360	      13 	Inter	0.049	 0.06	 0.33	  0.3	 48	 163	somepass road
- -0.221154	  -0.518671	      -2 	Waypt	0.075	 0.09	 0.40	  0.4	 48	  92	somepass road
+ -0.221154	  -0.518671	      -2 	Waypt#2	0.075	 0.09	 0.40	  0.4	 48	  92	somepass road
  -0.221123	  -0.519360	      13 	Inter	0.075	 0.09	 0.48	  0.5	 48	 272	somepass road
  -0.220695	  -0.519489	      12*	Junct	0.049	 0.06	 0.53	  0.5	 48	 343	somepass road
  -0.220694	  -0.519227	      15 	Inter	0.029	 0.04	 0.55	  0.6	 48	  89	long road
@@ -21,4 +21,4 @@
  -0.220746	  -0.518070	      23 	Inter	0.037	 0.04	 0.88	  1.0	 48	 149	long road
  -0.220739	  -0.517801	      26*	Junct	0.029	 0.04	 0.91	  1.0	 48	  88	long road
  -0.220784	  -0.516035	      31*	Junct	0.196	 0.18	 1.11	  1.2	 64	  91	high street
- -0.219593	  -0.515985	      -3 	Waypt	0.132	 0.08	 1.24	  1.3	 96	   2	main 2
+ -0.219593	  -0.515985	      -3 	Waypt#3	0.132	 0.08	 1.24	  1.3	 96	   2	main 2
diff --git a/src/test/expected/node-restrictions-WP03.txt b/src/test/expected/node-restrictions-WP03.txt
index db18d43..28a37a0 100644
--- a/src/test/expected/node-restrictions-WP03.txt
+++ b/src/test/expected/node-restrictions-WP03.txt
@@ -4,7 +4,7 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219564	  -0.520846	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219564	  -0.520846	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220666	  -0.520893	       4*	Junct	0.122	 0.07	 0.12	  0.1	 96	 182	main 1
  -0.220682	  -0.520141	       9*	Junct	0.083	 0.08	 0.20	  0.2	 64	  91	high street
  -0.220695	  -0.519489	      12*	Change	0.072	 0.07	 0.28	  0.2	 64	  91	high street
@@ -17,8 +17,8 @@
  -0.220746	  -0.518070	      23 	Inter	0.037	 0.04	 0.64	  0.7	 48	 149	long road
  -0.220739	  -0.517801	      26*	Junct	0.029	 0.04	 0.66	  0.7	 48	  88	long road
  -0.221166	  -0.517916	      24 	Inter	0.049	 0.06	 0.71	  0.8	 48	 195	somepass road
- -0.221157	  -0.518560	      -2 	Waypt	0.070	 0.09	 0.78	  0.8	 48	 270	somepass road
+ -0.221157	  -0.518560	      -2 	Waypt#2	0.070	 0.09	 0.78	  0.8	 48	 270	somepass road
  -0.221166	  -0.517916	      24 	Inter	0.070	 0.09	 0.85	  0.9	 48	  90	somepass road
  -0.220739	  -0.517801	      26*	Junct	0.049	 0.06	 0.90	  1.0	 48	  15	somepass road
  -0.220784	  -0.516035	      31*	Junct	0.196	 0.18	 1.10	  1.2	 64	  91	high street
- -0.219593	  -0.515985	      -3 	Waypt	0.132	 0.08	 1.23	  1.3	 96	   2	main 2
+ -0.219593	  -0.515985	      -3 	Waypt#3	0.132	 0.08	 1.23	  1.3	 96	   2	main 2
diff --git a/src/test/expected/node-restrictions-WP04.txt b/src/test/expected/node-restrictions-WP04.txt
index 44982e4..d127bb5 100644
--- a/src/test/expected/node-restrictions-WP04.txt
+++ b/src/test/expected/node-restrictions-WP04.txt
@@ -4,12 +4,12 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219564	  -0.520846	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219564	  -0.520846	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220666	  -0.520893	       4*	Junct	0.122	 0.07	 0.12	  0.1	 96	 182	main 1
  -0.220682	  -0.520141	       9*	Junct	0.083	 0.08	 0.20	  0.2	 64	  91	high street
  -0.220695	  -0.519489	      12*	Change	0.072	 0.07	 0.28	  0.2	 64	  91	high street
  -0.220140	  -0.519342	      14 	Inter	0.063	 0.08	 0.34	  0.3	 48	  14	nopass road
- -0.220173	  -0.518597	      20 	Waypt	0.082	 0.10	 0.42	  0.4	 48	  92	nopass road
+ -0.220173	  -0.518597	      20 	Waypt#2	0.082	 0.10	 0.42	  0.4	 48	  92	nopass road
  -0.220140	  -0.519342	      14 	Inter	0.082	 0.10	 0.50	  0.5	 48	 272	nopass road
  -0.220695	  -0.519489	      12*	Junct	0.063	 0.08	 0.57	  0.6	 48	 194	nopass road
  -0.220694	  -0.519227	      15 	Inter	0.029	 0.04	 0.60	  0.6	 48	  89	long road
@@ -21,4 +21,4 @@
  -0.220746	  -0.518070	      23 	Inter	0.037	 0.04	 0.93	  1.0	 48	 149	long road
  -0.220739	  -0.517801	      26*	Junct	0.029	 0.04	 0.95	  1.1	 48	  88	long road
  -0.220784	  -0.516035	      31*	Junct	0.196	 0.18	 1.15	  1.2	 64	  91	high street
- -0.219593	  -0.515985	      -3 	Waypt	0.132	 0.08	 1.28	  1.3	 96	   2	main 2
+ -0.219593	  -0.515985	      -3 	Waypt#3	0.132	 0.08	 1.28	  1.3	 96	   2	main 2
diff --git a/src/test/expected/node-restrictions-WP05.txt b/src/test/expected/node-restrictions-WP05.txt
index b415fda..a4b84fb 100644
--- a/src/test/expected/node-restrictions-WP05.txt
+++ b/src/test/expected/node-restrictions-WP05.txt
@@ -4,12 +4,12 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219564	  -0.520846	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219564	  -0.520846	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220666	  -0.520893	       4*	Junct	0.122	 0.07	 0.12	  0.1	 96	 182	main 1
  -0.220682	  -0.520141	       9*	Junct	0.083	 0.08	 0.20	  0.2	 64	  91	high street
  -0.220695	  -0.519489	      12*	Change	0.072	 0.07	 0.28	  0.2	 64	  91	high street
  -0.220140	  -0.519342	      14 	Inter	0.063	 0.08	 0.34	  0.3	 48	  14	nopass road
- -0.220170	  -0.518653	      -2 	Waypt	0.075	 0.09	 0.41	  0.4	 48	  92	nopass road
+ -0.220170	  -0.518653	      -2 	Waypt#2	0.075	 0.09	 0.41	  0.4	 48	  92	nopass road
  -0.220140	  -0.519342	      14 	Inter	0.075	 0.09	 0.49	  0.5	 48	 272	nopass road
  -0.220695	  -0.519489	      12*	Junct	0.063	 0.08	 0.55	  0.6	 48	 194	nopass road
  -0.220694	  -0.519227	      15 	Inter	0.029	 0.04	 0.58	  0.6	 48	  89	long road
@@ -21,4 +21,4 @@
  -0.220746	  -0.518070	      23 	Inter	0.037	 0.04	 0.91	  1.0	 48	 149	long road
  -0.220739	  -0.517801	      26*	Junct	0.029	 0.04	 0.94	  1.0	 48	  88	long road
  -0.220784	  -0.516035	      31*	Junct	0.196	 0.18	 1.14	  1.2	 64	  91	high street
- -0.219593	  -0.515985	      -3 	Waypt	0.132	 0.08	 1.27	  1.3	 96	   2	main 2
+ -0.219593	  -0.515985	      -3 	Waypt#3	0.132	 0.08	 1.27	  1.3	 96	   2	main 2
diff --git a/src/test/expected/node-restrictions-WP06.txt b/src/test/expected/node-restrictions-WP06.txt
index f233e8c..a8d6c78 100644
--- a/src/test/expected/node-restrictions-WP06.txt
+++ b/src/test/expected/node-restrictions-WP06.txt
@@ -4,7 +4,7 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219564	  -0.520846	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219564	  -0.520846	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220666	  -0.520893	       4*	Junct	0.122	 0.07	 0.12	  0.1	 96	 182	main 1
  -0.220682	  -0.520141	       9*	Junct	0.083	 0.08	 0.20	  0.2	 64	  91	high street
  -0.220695	  -0.519489	      12*	Change	0.072	 0.07	 0.28	  0.2	 64	  91	high street
@@ -17,8 +17,8 @@
  -0.220746	  -0.518070	      23 	Inter	0.037	 0.04	 0.64	  0.7	 48	 149	long road
  -0.220739	  -0.517801	      26*	Junct	0.029	 0.04	 0.66	  0.7	 48	  88	long road
  -0.220212	  -0.517903	      25 	Inter	0.059	 0.07	 0.72	  0.8	 48	 349	nopass road
- -0.220176	  -0.518543	      -2 	Waypt	0.070	 0.09	 0.79	  0.9	 48	 273	nopass road
+ -0.220176	  -0.518543	      -2 	Waypt#2	0.070	 0.09	 0.79	  0.9	 48	 273	nopass road
  -0.220212	  -0.517903	      25 	Inter	0.070	 0.09	 0.86	  0.9	 48	  93	nopass road
  -0.220739	  -0.517801	      26*	Junct	0.059	 0.07	 0.92	  1.0	 48	 169	nopass road
  -0.220784	  -0.516035	      31*	Junct	0.196	 0.18	 1.12	  1.2	 64	  91	high street
- -0.219593	  -0.515985	      -3 	Waypt	0.132	 0.08	 1.25	  1.3	 96	   2	main 2
+ -0.219593	  -0.515985	      -3 	Waypt#3	0.132	 0.08	 1.25	  1.3	 96	   2	main 2
diff --git a/src/test/expected/node-restrictions-WP07.txt b/src/test/expected/node-restrictions-WP07.txt
index d9df640..e21651e 100644
--- a/src/test/expected/node-restrictions-WP07.txt
+++ b/src/test/expected/node-restrictions-WP07.txt
@@ -4,10 +4,10 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219564	  -0.520846	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219564	  -0.520846	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220666	  -0.520893	       4*	Junct	0.122	 0.07	 0.12	  0.1	 96	 182	main 1
  -0.220682	  -0.520141	       9*	Junct	0.083	 0.08	 0.20	  0.2	 64	  91	high street
- -0.219009	  -0.520075	      10*	Waypt	0.186	 0.17	 0.39	  0.3	 64	   2	dead end road
+ -0.219009	  -0.520075	      10*	Waypt#2	0.186	 0.17	 0.39	  0.3	 64	   2	dead end road
  -0.220682	  -0.520141	       9*	Junct	0.186	 0.17	 0.58	  0.5	 64	 182	dead end road
  -0.220695	  -0.519489	      12*	Change	0.072	 0.07	 0.65	  0.6	 64	  91	high street
  -0.220694	  -0.519227	      15 	Inter	0.029	 0.04	 0.68	  0.6	 48	  89	long road
@@ -19,4 +19,4 @@
  -0.220746	  -0.518070	      23 	Inter	0.037	 0.04	 1.01	  1.0	 48	 149	long road
  -0.220739	  -0.517801	      26*	Junct	0.029	 0.04	 1.04	  1.0	 48	  88	long road
  -0.220784	  -0.516035	      31*	Junct	0.196	 0.18	 1.23	  1.2	 64	  91	high street
- -0.219593	  -0.515985	      -3 	Waypt	0.132	 0.08	 1.36	  1.3	 96	   2	main 2
+ -0.219593	  -0.515985	      -3 	Waypt#3	0.132	 0.08	 1.36	  1.3	 96	   2	main 2
diff --git a/src/test/expected/node-restrictions-WP08.txt b/src/test/expected/node-restrictions-WP08.txt
index d9df640..e21651e 100644
--- a/src/test/expected/node-restrictions-WP08.txt
+++ b/src/test/expected/node-restrictions-WP08.txt
@@ -4,10 +4,10 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219564	  -0.520846	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219564	  -0.520846	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220666	  -0.520893	       4*	Junct	0.122	 0.07	 0.12	  0.1	 96	 182	main 1
  -0.220682	  -0.520141	       9*	Junct	0.083	 0.08	 0.20	  0.2	 64	  91	high street
- -0.219009	  -0.520075	      10*	Waypt	0.186	 0.17	 0.39	  0.3	 64	   2	dead end road
+ -0.219009	  -0.520075	      10*	Waypt#2	0.186	 0.17	 0.39	  0.3	 64	   2	dead end road
  -0.220682	  -0.520141	       9*	Junct	0.186	 0.17	 0.58	  0.5	 64	 182	dead end road
  -0.220695	  -0.519489	      12*	Change	0.072	 0.07	 0.65	  0.6	 64	  91	high street
  -0.220694	  -0.519227	      15 	Inter	0.029	 0.04	 0.68	  0.6	 48	  89	long road
@@ -19,4 +19,4 @@
  -0.220746	  -0.518070	      23 	Inter	0.037	 0.04	 1.01	  1.0	 48	 149	long road
  -0.220739	  -0.517801	      26*	Junct	0.029	 0.04	 1.04	  1.0	 48	  88	long road
  -0.220784	  -0.516035	      31*	Junct	0.196	 0.18	 1.23	  1.2	 64	  91	high street
- -0.219593	  -0.515985	      -3 	Waypt	0.132	 0.08	 1.36	  1.3	 96	   2	main 2
+ -0.219593	  -0.515985	      -3 	Waypt#3	0.132	 0.08	 1.36	  1.3	 96	   2	main 2
diff --git a/src/test/expected/oneway-loop-WP01.txt b/src/test/expected/oneway-loop-WP01.txt
index bbe397a..ebf9509 100644
--- a/src/test/expected/oneway-loop-WP01.txt
+++ b/src/test/expected/oneway-loop-WP01.txt
@@ -4,14 +4,14 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.219564	  -0.520846	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.219564	  -0.520846	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.220666	  -0.520893	       4*	Junct	0.122	 0.07	 0.12	  0.1	 96	 182	main 1
  -0.220695	  -0.519489	       9*	Inter	0.156	 0.20	 0.28	  0.3	 48	  91	high street
  -0.220739	  -0.517801	      12*	Junct	0.187	 0.23	 0.47	  0.5	 48	  91	high street
  -0.220405	  -0.517799	      13 	Inter	0.037	 0.04	 0.50	  0.5	 48	   0	reverse loop
- -0.220210	  -0.518605	      11 	Waypt	0.092	 0.12	 0.59	  0.7	 48	 283	reverse loop
+ -0.220210	  -0.518605	      11 	Waypt#2	0.092	 0.12	 0.59	  0.7	 48	 283	reverse loop
  -0.220333	  -0.519485	      10 	Inter	0.098	 0.12	 0.69	  0.8	 48	 262	reverse loop
  -0.220695	  -0.519489	       9*	Inter	0.040	 0.05	 0.73	  0.8	 48	 180	reverse loop
  -0.220739	  -0.517801	      12*	Junct	0.187	 0.23	 0.92	  1.1	 48	  91	high street
  -0.220784	  -0.516035	      18*	Junct	0.196	 0.24	 1.11	  1.3	 48	  91	high street
- -0.219593	  -0.515985	      -3 	Waypt	0.132	 0.08	 1.25	  1.4	 96	   2	main 2
+ -0.219593	  -0.515985	      -3 	Waypt#3	0.132	 0.08	 1.25	  1.4	 96	   2	main 2
diff --git a/src/test/expected/roundabout-waypoints-WP01.txt b/src/test/expected/roundabout-waypoints-WP01.txt
index 304b108..9ca98f8 100644
--- a/src/test/expected/roundabout-waypoints-WP01.txt
+++ b/src/test/expected/roundabout-waypoints-WP01.txt
@@ -4,9 +4,9 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.218454	  -0.520798	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
- -0.219482	  -0.520837	       9*	Waypt	0.113	 0.07	 0.11	  0.1	 96	 182	main 1
+ -0.218454	  -0.520798	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
+ -0.219482	  -0.520837	       9*	Waypt#2	0.113	 0.07	 0.11	  0.1	 96	 182	main 1
  -0.219692	  -0.520509	      15 	Junct-	0.043	 0.03	 0.16	  0.1	 96	 122	roundabout
  -0.220082	  -0.520522	      14 	Junct-	0.043	 0.03	 0.20	  0.1	 96	 181	roundabout
  -0.220268	  -0.520863	       8*	Junct	0.043	 0.03	 0.24	  0.1	 96	 241	roundabout
- -0.221566	  -0.520921	      -3 	Waypt	0.143	 0.09	 0.39	  0.2	 96	 182	main 2
+ -0.221566	  -0.520921	      -3 	Waypt#3	0.143	 0.09	 0.39	  0.2	 96	 182	main 2
diff --git a/src/test/expected/roundabout-waypoints-WP02.txt b/src/test/expected/roundabout-waypoints-WP02.txt
index 5ce9cbf..edd9c3a 100644
--- a/src/test/expected/roundabout-waypoints-WP02.txt
+++ b/src/test/expected/roundabout-waypoints-WP02.txt
@@ -4,10 +4,10 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.218454	  -0.520798	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.218454	  -0.520798	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.219482	  -0.520837	       9*	Junct	0.113	 0.07	 0.11	  0.1	 96	 182	main 1
- -0.219577	  -0.520689	      -2 	Waypt	0.019	 0.01	 0.13	  0.1	 96	 122	roundabout
+ -0.219577	  -0.520689	      -2 	Waypt#2	0.019	 0.01	 0.13	  0.1	 96	 122	roundabout
  -0.219692	  -0.520509	      15 	Junct-	0.023	 0.01	 0.15	  0.1	 96	 122	roundabout
  -0.220082	  -0.520522	      14 	Junct-	0.043	 0.03	 0.20	  0.1	 96	 181	roundabout
  -0.220268	  -0.520863	       8*	Junct	0.043	 0.03	 0.24	  0.1	 96	 241	roundabout
- -0.221566	  -0.520921	      -3 	Waypt	0.143	 0.09	 0.38	  0.2	 96	 182	main 2
+ -0.221566	  -0.520921	      -3 	Waypt#3	0.143	 0.09	 0.38	  0.2	 96	 182	main 2
diff --git a/src/test/expected/roundabout-waypoints-WP03.txt b/src/test/expected/roundabout-waypoints-WP03.txt
index a5a6398..fcd35b5 100644
--- a/src/test/expected/roundabout-waypoints-WP03.txt
+++ b/src/test/expected/roundabout-waypoints-WP03.txt
@@ -4,9 +4,9 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.218454	  -0.520798	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.218454	  -0.520798	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.219482	  -0.520837	       9*	Junct	0.113	 0.07	 0.11	  0.1	 96	 182	main 1
- -0.219692	  -0.520509	      15 	Waypt	0.043	 0.03	 0.16	  0.1	 96	 122	roundabout
+ -0.219692	  -0.520509	      15 	Waypt#2	0.043	 0.03	 0.16	  0.1	 96	 122	roundabout
  -0.220082	  -0.520522	      14 	Junct-	0.043	 0.03	 0.20	  0.1	 96	 181	roundabout
  -0.220268	  -0.520863	       8*	Junct	0.043	 0.03	 0.24	  0.1	 96	 241	roundabout
- -0.221566	  -0.520921	      -3 	Waypt	0.143	 0.09	 0.39	  0.2	 96	 182	main 2
+ -0.221566	  -0.520921	      -3 	Waypt#3	0.143	 0.09	 0.39	  0.2	 96	 182	main 2
diff --git a/src/test/expected/roundabout-waypoints-WP04.txt b/src/test/expected/roundabout-waypoints-WP04.txt
index dc04878..01dae5a 100644
--- a/src/test/expected/roundabout-waypoints-WP04.txt
+++ b/src/test/expected/roundabout-waypoints-WP04.txt
@@ -4,10 +4,10 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.218454	  -0.520798	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.218454	  -0.520798	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.219482	  -0.520837	       9*	Junct	0.113	 0.07	 0.11	  0.1	 96	 182	main 1
  -0.219692	  -0.520509	      15 	Junct-	0.043	 0.03	 0.16	  0.1	 96	 122	roundabout
- -0.219878	  -0.520515	      -2 	Waypt	0.020	 0.01	 0.18	  0.1	 96	 181	roundabout
+ -0.219878	  -0.520515	      -2 	Waypt#2	0.020	 0.01	 0.18	  0.1	 96	 181	roundabout
  -0.220082	  -0.520522	      14 	Junct-	0.022	 0.01	 0.20	  0.1	 96	 181	roundabout
  -0.220268	  -0.520863	       8*	Junct	0.043	 0.03	 0.24	  0.1	 96	 241	roundabout
- -0.221566	  -0.520921	      -3 	Waypt	0.143	 0.09	 0.38	  0.2	 96	 182	main 2
+ -0.221566	  -0.520921	      -3 	Waypt#3	0.143	 0.09	 0.38	  0.2	 96	 182	main 2
diff --git a/src/test/expected/roundabout-waypoints-WP05.txt b/src/test/expected/roundabout-waypoints-WP05.txt
index d8e2149..58e459a 100644
--- a/src/test/expected/roundabout-waypoints-WP05.txt
+++ b/src/test/expected/roundabout-waypoints-WP05.txt
@@ -4,9 +4,9 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.218454	  -0.520798	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.218454	  -0.520798	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.219482	  -0.520837	       9*	Junct	0.113	 0.07	 0.11	  0.1	 96	 182	main 1
  -0.219692	  -0.520509	      15 	Junct-	0.043	 0.03	 0.16	  0.1	 96	 122	roundabout
- -0.220082	  -0.520522	      14 	Waypt	0.043	 0.03	 0.20	  0.1	 96	 181	roundabout
+ -0.220082	  -0.520522	      14 	Waypt#2	0.043	 0.03	 0.20	  0.1	 96	 181	roundabout
  -0.220268	  -0.520863	       8*	Junct	0.043	 0.03	 0.24	  0.1	 96	 241	roundabout
- -0.221566	  -0.520921	      -3 	Waypt	0.143	 0.09	 0.39	  0.2	 96	 182	main 2
+ -0.221566	  -0.520921	      -3 	Waypt#3	0.143	 0.09	 0.39	  0.2	 96	 182	main 2
diff --git a/src/test/expected/roundabout-waypoints-WP06.txt b/src/test/expected/roundabout-waypoints-WP06.txt
index 097a52a..118c650 100644
--- a/src/test/expected/roundabout-waypoints-WP06.txt
+++ b/src/test/expected/roundabout-waypoints-WP06.txt
@@ -4,10 +4,10 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.218454	  -0.520798	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.218454	  -0.520798	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.219482	  -0.520837	       9*	Junct	0.113	 0.07	 0.11	  0.1	 96	 182	main 1
  -0.219692	  -0.520509	      15 	Junct-	0.043	 0.03	 0.16	  0.1	 96	 122	roundabout
  -0.220082	  -0.520522	      14 	Junct-	0.043	 0.03	 0.20	  0.1	 96	 181	roundabout
- -0.220171	  -0.520685	      -2 	Waypt	0.020	 0.01	 0.22	  0.1	 96	 241	roundabout
+ -0.220171	  -0.520685	      -2 	Waypt#2	0.020	 0.01	 0.22	  0.1	 96	 241	roundabout
  -0.220268	  -0.520863	       8*	Junct	0.022	 0.01	 0.24	  0.1	 96	 241	roundabout
- -0.221566	  -0.520921	      -3 	Waypt	0.143	 0.09	 0.38	  0.2	 96	 182	main 2
+ -0.221566	  -0.520921	      -3 	Waypt#3	0.143	 0.09	 0.38	  0.2	 96	 182	main 2
diff --git a/src/test/expected/roundabout-waypoints-WP07.txt b/src/test/expected/roundabout-waypoints-WP07.txt
index 5dd7a74..979c710 100644
--- a/src/test/expected/roundabout-waypoints-WP07.txt
+++ b/src/test/expected/roundabout-waypoints-WP07.txt
@@ -4,9 +4,9 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.218454	  -0.520798	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.218454	  -0.520798	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.219482	  -0.520837	       9*	Junct	0.113	 0.07	 0.11	  0.1	 96	 182	main 1
  -0.219692	  -0.520509	      15 	Junct-	0.043	 0.03	 0.16	  0.1	 96	 122	roundabout
  -0.220082	  -0.520522	      14 	Junct-	0.043	 0.03	 0.20	  0.1	 96	 181	roundabout
- -0.220268	  -0.520863	       8*	Waypt	0.043	 0.03	 0.24	  0.1	 96	 241	roundabout
- -0.221566	  -0.520921	      -3 	Waypt	0.143	 0.09	 0.39	  0.2	 96	 182	main 2
+ -0.220268	  -0.520863	       8*	Waypt#2	0.043	 0.03	 0.24	  0.1	 96	 241	roundabout
+ -0.221566	  -0.520921	      -3 	Waypt#3	0.143	 0.09	 0.39	  0.2	 96	 182	main 2
diff --git a/src/test/expected/super-or-not-WP01.txt b/src/test/expected/super-or-not-WP01.txt
index d76ce16..9a271f0 100644
--- a/src/test/expected/super-or-not-WP01.txt
+++ b/src/test/expected/super-or-not-WP01.txt
@@ -4,10 +4,10 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.216158	  -0.518809	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
- -0.216435	  -0.518515	       4 	Inter	0.044	 0.06	 0.04	  0.1	 48	 133	Local road
- -0.215866	  -0.517931	       5 	Inter	0.090	 0.11	 0.13	  0.2	 48	  45	Local road
- -0.216470	  -0.517412	       6 	Inter	0.088	 0.11	 0.22	  0.3	 48	 139	Local road
- -0.215930	  -0.516823	       7 	Inter	0.088	 0.11	 0.31	  0.4	 48	  47	Local road
- -0.216451	  -0.516221	       8 	Inter	0.088	 0.11	 0.40	  0.5	 48	 130	Local road
- -0.216158	  -0.515870	      -2 	Waypt	0.050	 0.06	 0.45	  0.6	 48	  50	Local road
+ -0.216158	  -0.518809	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
+ -0.216435	  -0.518515	      13 	Inter	0.044	 0.06	 0.04	  0.1	 48	 133	Local road
+ -0.215866	  -0.517931	      14 	Inter	0.090	 0.11	 0.13	  0.2	 48	  45	Local road
+ -0.216470	  -0.517412	      15 	Inter	0.088	 0.11	 0.22	  0.3	 48	 139	Local road
+ -0.215930	  -0.516823	      16 	Inter	0.088	 0.11	 0.31	  0.4	 48	  47	Local road
+ -0.216451	  -0.516221	      17 	Inter	0.088	 0.11	 0.40	  0.5	 48	 130	Local road
+ -0.216158	  -0.515870	      -2 	Waypt#2	0.050	 0.06	 0.45	  0.6	 48	  50	Local road
diff --git a/src/test/expected/super-or-not-WP02.txt b/src/test/expected/super-or-not-WP02.txt
index dc35d71..6a5bcb1 100644
--- a/src/test/expected/super-or-not-WP02.txt
+++ b/src/test/expected/super-or-not-WP02.txt
@@ -4,7 +4,7 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.216828	  -0.519457	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
- -0.217245	  -0.519637	       2*	Junct	0.050	 0.06	 0.05	  0.1	 48	 203	Local road
- -0.217248	  -0.515206	      10*	Junct	0.493	 0.31	 0.54	  0.4	 96	  90	Main road
- -0.216919	  -0.515308	      -2 	Waypt	0.038	 0.05	 0.58	  0.4	 48	 342	Local road
+ -0.216828	  -0.519457	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
+ -0.217245	  -0.519637	      11*	Junct	0.050	 0.06	 0.05	  0.1	 48	 203	Local road
+ -0.217248	  -0.515206	      19*	Junct	0.493	 0.31	 0.54	  0.4	 96	  90	Main road
+ -0.216919	  -0.515308	      -2 	Waypt#2	0.038	 0.05	 0.58	  0.4	 48	 342	Local road
diff --git a/src/test/expected/super-or-not-WP03.txt b/src/test/expected/super-or-not-WP03.txt
index 4e51634..db30510 100644
--- a/src/test/expected/super-or-not-WP03.txt
+++ b/src/test/expected/super-or-not-WP03.txt
@@ -4,7 +4,7 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.217245	  -0.519637	       2*	Waypt	0.000	 0.00	 0.00	  0.0			
- -0.215919	  -0.519064	       3 	Inter	0.160	 0.20	 0.16	  0.2	 48	  23	Local road
- -0.216435	  -0.518515	       4 	Inter	0.083	 0.10	 0.24	  0.3	 48	 133	Local road
- -0.215866	  -0.517931	       5 	Waypt	0.090	 0.11	 0.33	  0.4	 48	  45	Local road
+ -0.217245	  -0.519637	      11*	Waypt#1	0.000	 0.00	 0.00	  0.0			
+ -0.215919	  -0.519064	      12 	Inter	0.160	 0.20	 0.16	  0.2	 48	  23	Local road
+ -0.216435	  -0.518515	      13 	Inter	0.083	 0.10	 0.24	  0.3	 48	 133	Local road
+ -0.215866	  -0.517931	      14 	Waypt#2	0.090	 0.11	 0.33	  0.4	 48	  45	Local road
diff --git a/src/test/expected/super-or-not-WP04.txt b/src/test/expected/super-or-not-WP04.txt
new file mode 100644
index 0000000..7cf0fca
--- /dev/null
+++ b/src/test/expected/super-or-not-WP04.txt
@@ -0,0 +1,13 @@
+# Creator : Routino - http://www.routino.org/
+# Source : Routino test cases - (c) Andrew M. Bishop
+# License : GNU Affero General Public License v3 or later
+#
+#Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
+#        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
+ -0.217183	  -0.527270	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
+ -0.217197	  -0.525552	       5*	Junct-	0.190	 0.12	 0.19	  0.1	 96	  90	Main road
+ -0.217216	  -0.523210	       8*	Junct-	0.260	 0.16	 0.45	  0.3	 96	  90	Main road
+ -0.217245	  -0.519637	      11*	Junct-	0.397	 0.25	 0.85	  0.5	 96	  90	Main road
+ -0.217248	  -0.515206	      19*	Junct	0.493	 0.31	 1.34	  0.8	 96	  90	Main road
+ -0.215941	  -0.515611	      18 	Inter	0.152	 0.19	 1.49	  1.0	 48	 342	Local road
+ -0.216087	  -0.515786	      -2 	Waypt#2	0.025	 0.03	 1.52	  1.1	 48	 230	Local road
diff --git a/src/test/expected/super-or-not-WP05.txt b/src/test/expected/super-or-not-WP05.txt
new file mode 100644
index 0000000..33b773f
--- /dev/null
+++ b/src/test/expected/super-or-not-WP05.txt
@@ -0,0 +1,13 @@
+# Creator : Routino - http://www.routino.org/
+# Source : Routino test cases - (c) Andrew M. Bishop
+# License : GNU Affero General Public License v3 or later
+#
+#Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
+#        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
+ -0.216144	  -0.515853	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
+ -0.215941	  -0.515611	      18 	Inter	0.035	 0.04	 0.04	  0.0	 48	  50	Local road
+ -0.217248	  -0.515206	      19*	Junct	0.152	 0.19	 0.19	  0.2	 48	 162	Local road
+ -0.217245	  -0.519637	      11*	Junct-	0.493	 0.31	 0.68	  0.5	 96	 270	Main road
+ -0.217216	  -0.523210	       8*	Junct-	0.397	 0.25	 1.08	  0.8	 96	 270	Main road
+ -0.217197	  -0.525552	       5*	Junct-	0.260	 0.16	 1.34	  0.9	 96	 270	Main road
+ -0.217182	  -0.527397	      -2 	Waypt#2	0.204	 0.13	 1.54	  1.1	 96	 270	Main road
diff --git a/src/test/expected/turns-WP01.txt b/src/test/expected/turns-WP01.txt
index e88758c..6c0107f 100644
--- a/src/test/expected/turns-WP01.txt
+++ b/src/test/expected/turns-WP01.txt
@@ -4,7 +4,7 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.218453	  -0.520799	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.218453	  -0.520799	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.219107	  -0.520828	       6*	Junct-	0.072	 0.04	 0.07	  0.0	 96	 182	main 1
  -0.220666	  -0.520893	       5*	Junct	0.173	 0.11	 0.24	  0.2	 96	 182	main 1
  -0.220671	  -0.520223	      11*	Junct	0.074	 0.09	 0.32	  0.2	 48	  90	high street
@@ -12,8 +12,8 @@
  -0.220111	  -0.519553	      17 	Inter	0.065	 0.08	 0.47	  0.4	 48	 351	loop 1
  -0.219817	  -0.519807	      15 	Inter	0.043	 0.05	 0.51	  0.5	 48	 319	loop 1
  -0.220067	  -0.520109	      13*	Inter	0.043	 0.05	 0.55	  0.5	 48	 230	loop 1
- -0.220191	  -0.520132	      -2 	Waypt	0.014	 0.02	 0.57	  0.6	 48	 190	loop 1
+ -0.220191	  -0.520132	      -2 	Waypt#2	0.014	 0.02	 0.57	  0.6	 48	 190	loop 1
  -0.220671	  -0.520223	      11*	Junct	0.054	 0.07	 0.62	  0.6	 48	 190	loop 1
  -0.220666	  -0.520893	       5*	Junct	0.074	 0.09	 0.70	  0.7	 48	 270	high street
  -0.221308	  -0.520914	       4*	Junct-	0.071	 0.04	 0.77	  0.8	 96	 181	main 1
- -0.221561	  -0.520922	      -3 	Waypt	0.027	 0.02	 0.79	  0.8	 96	 181	main 1
+ -0.221561	  -0.520922	      -3 	Waypt#3	0.027	 0.02	 0.79	  0.8	 96	 181	main 1
diff --git a/src/test/expected/turns-WP02.txt b/src/test/expected/turns-WP02.txt
index 7a3934d..231f57b 100644
--- a/src/test/expected/turns-WP02.txt
+++ b/src/test/expected/turns-WP02.txt
@@ -4,15 +4,15 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.218453	  -0.520799	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.218453	  -0.520799	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.219107	  -0.520828	       6*	Junct-	0.072	 0.04	 0.07	  0.0	 96	 182	main 1
  -0.220666	  -0.520893	       5*	Junct	0.173	 0.11	 0.24	  0.2	 96	 182	main 1
  -0.220671	  -0.520223	      11*	Junct	0.074	 0.09	 0.32	  0.2	 48	  90	high street
  -0.220691	  -0.519461	      19*	Junct	0.084	 0.10	 0.40	  0.3	 48	  91	high street
  -0.220111	  -0.519553	      17 	Inter	0.065	 0.08	 0.47	  0.4	 48	 351	loop 1
  -0.219817	  -0.519807	      15 	Inter	0.043	 0.05	 0.51	  0.5	 48	 319	loop 1
- -0.220067	  -0.520109	      13*	Waypt	0.043	 0.05	 0.55	  0.5	 48	 230	loop 1
+ -0.220067	  -0.520109	      13*	Waypt#2	0.043	 0.05	 0.55	  0.5	 48	 230	loop 1
  -0.220671	  -0.520223	      11*	Junct	0.068	 0.09	 0.62	  0.6	 48	 190	loop 1
  -0.220666	  -0.520893	       5*	Junct	0.074	 0.09	 0.70	  0.7	 48	 270	high street
  -0.221308	  -0.520914	       4*	Junct-	0.071	 0.04	 0.77	  0.8	 96	 181	main 1
- -0.221561	  -0.520922	      -3 	Waypt	0.027	 0.02	 0.79	  0.8	 96	 181	main 1
+ -0.221561	  -0.520922	      -3 	Waypt#3	0.027	 0.02	 0.79	  0.8	 96	 181	main 1
diff --git a/src/test/expected/turns-WP03.txt b/src/test/expected/turns-WP03.txt
index bb60cf0..6b7f9ba 100644
--- a/src/test/expected/turns-WP03.txt
+++ b/src/test/expected/turns-WP03.txt
@@ -4,15 +4,15 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.218453	  -0.520799	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.218453	  -0.520799	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.219107	  -0.520828	       6*	Junct-	0.072	 0.04	 0.07	  0.0	 96	 182	main 1
  -0.220666	  -0.520893	       5*	Junct	0.173	 0.11	 0.24	  0.2	 96	 182	main 1
  -0.220671	  -0.520223	      11*	Junct	0.074	 0.09	 0.32	  0.2	 48	  90	high street
  -0.220691	  -0.519461	      19*	Junct	0.084	 0.10	 0.40	  0.3	 48	  91	high street
  -0.220111	  -0.519553	      17 	Inter	0.065	 0.08	 0.47	  0.4	 48	 351	loop 1
- -0.219817	  -0.519807	      15 	Waypt	0.043	 0.05	 0.51	  0.5	 48	 319	loop 1
+ -0.219817	  -0.519807	      15 	Waypt#2	0.043	 0.05	 0.51	  0.5	 48	 319	loop 1
  -0.220067	  -0.520109	      13*	Inter	0.043	 0.05	 0.55	  0.5	 48	 230	loop 1
  -0.220671	  -0.520223	      11*	Junct	0.068	 0.09	 0.62	  0.6	 48	 190	loop 1
  -0.220666	  -0.520893	       5*	Junct	0.074	 0.09	 0.70	  0.7	 48	 270	high street
  -0.221308	  -0.520914	       4*	Junct-	0.071	 0.04	 0.77	  0.8	 96	 181	main 1
- -0.221561	  -0.520922	      -3 	Waypt	0.027	 0.02	 0.79	  0.8	 96	 181	main 1
+ -0.221561	  -0.520922	      -3 	Waypt#3	0.027	 0.02	 0.79	  0.8	 96	 181	main 1
diff --git a/src/test/expected/turns-WP04.txt b/src/test/expected/turns-WP04.txt
index 13cc313..6e756d9 100644
--- a/src/test/expected/turns-WP04.txt
+++ b/src/test/expected/turns-WP04.txt
@@ -4,7 +4,7 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.218453	  -0.520799	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.218453	  -0.520799	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.219107	  -0.520828	       6*	Junct-	0.072	 0.04	 0.07	  0.0	 96	 182	main 1
  -0.220666	  -0.520893	       5*	Junct	0.173	 0.11	 0.24	  0.2	 96	 182	main 1
  -0.220671	  -0.520223	      11*	Junct	0.074	 0.09	 0.32	  0.2	 48	  90	high street
@@ -14,7 +14,7 @@
  -0.220143	  -0.518162	      30 	Inter	0.065	 0.08	 0.62	  0.6	 48	 351	loop 2
  -0.219850	  -0.518416	      27 	Inter	0.043	 0.05	 0.67	  0.7	 48	 319	loop 2
  -0.220100	  -0.518718	      24*	Inter	0.043	 0.05	 0.71	  0.7	 48	 230	loop 2
- -0.220206	  -0.518739	      -2 	Waypt	0.012	 0.01	 0.72	  0.7	 48	 191	loop 2
+ -0.220206	  -0.518739	      -2 	Waypt#2	0.012	 0.01	 0.72	  0.7	 48	 191	loop 2
  -0.220708	  -0.518842	      22*	Junct	0.057	 0.07	 0.78	  0.8	 48	 191	loop 2
  -0.220724	  -0.518071	      31*	Junct	0.085	 0.10	 0.86	  0.9	 48	  91	high street
  -0.220739	  -0.517425	      34*	Junct	0.071	 0.09	 0.93	  1.0	 48	  91	high street
@@ -24,4 +24,4 @@
  -0.221376	  -0.518235	      29*	Junct	0.242	 0.30	 1.40	  1.5	 48	 271	bottom road
  -0.221360	  -0.518860	      21*	Junct	0.069	 0.09	 1.47	  1.6	 48	 271	bottom road
  -0.221308	  -0.520914	       4*	Junct	0.228	 0.28	 1.70	  1.9	 48	 271	bottom road
- -0.221561	  -0.520922	      -3 	Waypt	0.027	 0.02	 1.73	  1.9	 96	 181	main 1
+ -0.221561	  -0.520922	      -3 	Waypt#3	0.027	 0.02	 1.73	  1.9	 96	 181	main 1
diff --git a/src/test/expected/turns-WP05.txt b/src/test/expected/turns-WP05.txt
index 1d7f66b..ee69abf 100644
--- a/src/test/expected/turns-WP05.txt
+++ b/src/test/expected/turns-WP05.txt
@@ -4,7 +4,7 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.218453	  -0.520799	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.218453	  -0.520799	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.219107	  -0.520828	       6*	Junct-	0.072	 0.04	 0.07	  0.0	 96	 182	main 1
  -0.220666	  -0.520893	       5*	Junct	0.173	 0.11	 0.24	  0.2	 96	 182	main 1
  -0.220671	  -0.520223	      11*	Junct	0.074	 0.09	 0.32	  0.2	 48	  90	high street
@@ -13,7 +13,7 @@
  -0.220724	  -0.518071	      31*	Junct	0.085	 0.10	 0.56	  0.5	 48	  91	high street
  -0.220143	  -0.518162	      30 	Inter	0.065	 0.08	 0.62	  0.6	 48	 351	loop 2
  -0.219850	  -0.518416	      27 	Inter	0.043	 0.05	 0.67	  0.7	 48	 319	loop 2
- -0.220100	  -0.518718	      24*	Waypt	0.043	 0.05	 0.71	  0.7	 48	 230	loop 2
+ -0.220100	  -0.518718	      24*	Waypt#2	0.043	 0.05	 0.71	  0.7	 48	 230	loop 2
  -0.220708	  -0.518842	      22*	Junct	0.069	 0.09	 0.78	  0.8	 48	 191	loop 2
  -0.220724	  -0.518071	      31*	Junct	0.085	 0.10	 0.86	  0.9	 48	  91	high street
  -0.220739	  -0.517425	      34*	Junct	0.071	 0.09	 0.93	  1.0	 48	  91	high street
@@ -23,4 +23,4 @@
  -0.221376	  -0.518235	      29*	Junct	0.242	 0.30	 1.40	  1.5	 48	 271	bottom road
  -0.221360	  -0.518860	      21*	Junct	0.069	 0.09	 1.47	  1.6	 48	 271	bottom road
  -0.221308	  -0.520914	       4*	Junct	0.228	 0.28	 1.70	  1.9	 48	 271	bottom road
- -0.221561	  -0.520922	      -3 	Waypt	0.027	 0.02	 1.73	  1.9	 96	 181	main 1
+ -0.221561	  -0.520922	      -3 	Waypt#3	0.027	 0.02	 1.73	  1.9	 96	 181	main 1
diff --git a/src/test/expected/turns-WP06.txt b/src/test/expected/turns-WP06.txt
index e89e68f..658c148 100644
--- a/src/test/expected/turns-WP06.txt
+++ b/src/test/expected/turns-WP06.txt
@@ -4,7 +4,7 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.218453	  -0.520799	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.218453	  -0.520799	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.219107	  -0.520828	       6*	Junct-	0.072	 0.04	 0.07	  0.0	 96	 182	main 1
  -0.220666	  -0.520893	       5*	Junct	0.173	 0.11	 0.24	  0.2	 96	 182	main 1
  -0.220671	  -0.520223	      11*	Junct	0.074	 0.09	 0.32	  0.2	 48	  90	high street
@@ -12,7 +12,7 @@
  -0.220708	  -0.518842	      22*	Junct	0.069	 0.09	 0.47	  0.4	 48	  91	high street
  -0.220724	  -0.518071	      31*	Junct	0.085	 0.10	 0.56	  0.5	 48	  91	high street
  -0.220143	  -0.518162	      30 	Inter	0.065	 0.08	 0.62	  0.6	 48	 351	loop 2
- -0.219850	  -0.518416	      27 	Waypt	0.043	 0.05	 0.67	  0.7	 48	 319	loop 2
+ -0.219850	  -0.518416	      27 	Waypt#2	0.043	 0.05	 0.67	  0.7	 48	 319	loop 2
  -0.220100	  -0.518718	      24*	Inter	0.043	 0.05	 0.71	  0.7	 48	 230	loop 2
  -0.220708	  -0.518842	      22*	Junct	0.069	 0.09	 0.78	  0.8	 48	 191	loop 2
  -0.220724	  -0.518071	      31*	Junct	0.085	 0.10	 0.86	  0.9	 48	  91	high street
@@ -23,4 +23,4 @@
  -0.221376	  -0.518235	      29*	Junct	0.242	 0.30	 1.40	  1.5	 48	 271	bottom road
  -0.221360	  -0.518860	      21*	Junct	0.069	 0.09	 1.47	  1.6	 48	 271	bottom road
  -0.221308	  -0.520914	       4*	Junct	0.228	 0.28	 1.70	  1.9	 48	 271	bottom road
- -0.221561	  -0.520922	      -3 	Waypt	0.027	 0.02	 1.73	  1.9	 96	 181	main 1
+ -0.221561	  -0.520922	      -3 	Waypt#3	0.027	 0.02	 1.73	  1.9	 96	 181	main 1
diff --git a/src/test/expected/turns-WP07.txt b/src/test/expected/turns-WP07.txt
index fae0c9b..e7c407d 100644
--- a/src/test/expected/turns-WP07.txt
+++ b/src/test/expected/turns-WP07.txt
@@ -4,7 +4,7 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.218453	  -0.520799	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.218453	  -0.520799	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.219107	  -0.520828	       6*	Junct	0.072	 0.04	 0.07	  0.0	 96	 182	main 1
  -0.219123	  -0.520207	      12*	Junct	0.069	 0.09	 0.14	  0.1	 48	  91	top road
  -0.219131	  -0.519426	      20*	Junct	0.086	 0.11	 0.23	  0.2	 48	  90	top road
@@ -19,7 +19,7 @@
  -0.220784	  -0.516035	      54*	Junct	0.178	 0.11	 0.81	  0.8	 96	 182	main 2
  -0.220760	  -0.516647	      48*	Junct	0.068	 0.09	 0.88	  0.9	 48	 272	high street
  -0.220739	  -0.517425	      34*	Junct	0.086	 0.11	 0.96	  1.0	 48	 271	high street
- -0.220238	  -0.517313	      -2 	Waypt	0.057	 0.07	 1.02	  1.1	 48	  12	loop 3
+ -0.220238	  -0.517313	      -2 	Waypt#2	0.057	 0.07	 1.02	  1.1	 48	  12	loop 3
  -0.220089	  -0.517279	      35*	Inter	0.017	 0.02	 1.04	  1.1	 48	  12	loop 3
  -0.219872	  -0.517009	      43 	Inter	0.038	 0.05	 1.08	  1.2	 48	  51	loop 3
  -0.220097	  -0.516762	      47*	Inter	0.037	 0.04	 1.11	  1.2	 48	 132	loop 3
@@ -31,4 +31,4 @@
  -0.220671	  -0.520223	      11*	Junct	0.084	 0.10	 1.58	  1.8	 48	 271	high street
  -0.220666	  -0.520893	       5*	Junct	0.074	 0.09	 1.66	  1.9	 48	 270	high street
  -0.221308	  -0.520914	       4*	Junct-	0.071	 0.04	 1.73	  1.9	 96	 181	main 1
- -0.221561	  -0.520922	      -3 	Waypt	0.027	 0.02	 1.75	  2.0	 96	 181	main 1
+ -0.221561	  -0.520922	      -3 	Waypt#3	0.027	 0.02	 1.75	  2.0	 96	 181	main 1
diff --git a/src/test/expected/turns-WP08.txt b/src/test/expected/turns-WP08.txt
index 5b53349..329ae24 100644
--- a/src/test/expected/turns-WP08.txt
+++ b/src/test/expected/turns-WP08.txt
@@ -4,7 +4,7 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.218453	  -0.520799	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.218453	  -0.520799	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.219107	  -0.520828	       6*	Junct	0.072	 0.04	 0.07	  0.0	 96	 182	main 1
  -0.219123	  -0.520207	      12*	Junct	0.069	 0.09	 0.14	  0.1	 48	  91	top road
  -0.219131	  -0.519426	      20*	Junct	0.086	 0.11	 0.23	  0.2	 48	  90	top road
@@ -20,7 +20,7 @@
  -0.220760	  -0.516647	      48*	Junct	0.068	 0.09	 0.88	  0.9	 48	 272	high street
  -0.220097	  -0.516762	      47*	Inter	0.074	 0.09	 0.95	  1.0	 48	 350	loop 3
  -0.219872	  -0.517009	      43 	Inter	0.037	 0.04	 0.99	  1.1	 48	 312	loop 3
- -0.220089	  -0.517279	      35*	Waypt	0.038	 0.05	 1.03	  1.1	 48	 231	loop 3
+ -0.220089	  -0.517279	      35*	Waypt#2	0.038	 0.05	 1.03	  1.1	 48	 231	loop 3
  -0.220739	  -0.517425	      34*	Junct	0.074	 0.09	 1.10	  1.2	 48	 192	loop 3
  -0.220724	  -0.518071	      31*	Junct	0.071	 0.09	 1.17	  1.3	 48	 271	high street
  -0.220708	  -0.518842	      22*	Junct	0.085	 0.10	 1.26	  1.4	 48	 271	high street
@@ -28,4 +28,4 @@
  -0.220671	  -0.520223	      11*	Junct	0.084	 0.10	 1.41	  1.6	 48	 271	high street
  -0.220666	  -0.520893	       5*	Junct	0.074	 0.09	 1.48	  1.7	 48	 270	high street
  -0.221308	  -0.520914	       4*	Junct-	0.071	 0.04	 1.55	  1.7	 96	 181	main 1
- -0.221561	  -0.520922	      -3 	Waypt	0.027	 0.02	 1.58	  1.7	 96	 181	main 1
+ -0.221561	  -0.520922	      -3 	Waypt#3	0.027	 0.02	 1.58	  1.7	 96	 181	main 1
diff --git a/src/test/expected/turns-WP09.txt b/src/test/expected/turns-WP09.txt
index 684a7ba..cc9993d 100644
--- a/src/test/expected/turns-WP09.txt
+++ b/src/test/expected/turns-WP09.txt
@@ -4,7 +4,7 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.218453	  -0.520799	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.218453	  -0.520799	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.219107	  -0.520828	       6*	Junct	0.072	 0.04	 0.07	  0.0	 96	 182	main 1
  -0.219123	  -0.520207	      12*	Junct	0.069	 0.09	 0.14	  0.1	 48	  91	top road
  -0.219131	  -0.519426	      20*	Junct	0.086	 0.11	 0.23	  0.2	 48	  90	top road
@@ -19,7 +19,7 @@
  -0.220784	  -0.516035	      54*	Junct	0.178	 0.11	 0.81	  0.8	 96	 182	main 2
  -0.220760	  -0.516647	      48*	Junct	0.068	 0.09	 0.88	  0.9	 48	 272	high street
  -0.220097	  -0.516762	      47*	Inter	0.074	 0.09	 0.95	  1.0	 48	 350	loop 3
- -0.219872	  -0.517009	      43 	Waypt	0.037	 0.04	 0.99	  1.1	 48	 312	loop 3
+ -0.219872	  -0.517009	      43 	Waypt#2	0.037	 0.04	 0.99	  1.1	 48	 312	loop 3
  -0.220089	  -0.517279	      35*	Inter	0.038	 0.05	 1.03	  1.1	 48	 231	loop 3
  -0.220739	  -0.517425	      34*	Junct	0.074	 0.09	 1.10	  1.2	 48	 192	loop 3
  -0.220724	  -0.518071	      31*	Junct	0.071	 0.09	 1.17	  1.3	 48	 271	high street
@@ -28,4 +28,4 @@
  -0.220671	  -0.520223	      11*	Junct	0.084	 0.10	 1.41	  1.6	 48	 271	high street
  -0.220666	  -0.520893	       5*	Junct	0.074	 0.09	 1.48	  1.7	 48	 270	high street
  -0.221308	  -0.520914	       4*	Junct-	0.071	 0.04	 1.55	  1.7	 96	 181	main 1
- -0.221561	  -0.520922	      -3 	Waypt	0.027	 0.02	 1.58	  1.7	 96	 181	main 1
+ -0.221561	  -0.520922	      -3 	Waypt#3	0.027	 0.02	 1.58	  1.7	 96	 181	main 1
diff --git a/src/test/expected/turns-WP10.txt b/src/test/expected/turns-WP10.txt
index dfa0ca1..43d7f6d 100644
--- a/src/test/expected/turns-WP10.txt
+++ b/src/test/expected/turns-WP10.txt
@@ -4,7 +4,7 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.218453	  -0.520799	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.218453	  -0.520799	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.219107	  -0.520828	       6*	Junct	0.072	 0.04	 0.07	  0.0	 96	 182	main 1
  -0.219123	  -0.520207	      12*	Junct	0.069	 0.09	 0.14	  0.1	 48	  91	top road
  -0.219131	  -0.519426	      20*	Junct	0.086	 0.11	 0.23	  0.2	 48	  90	top road
@@ -23,7 +23,7 @@
  -0.219135	  -0.518823	      23*	Junct	0.133	 0.17	 0.79	  0.9	 48	 270	top road
  -0.219131	  -0.519426	      20*	Junct	0.067	 0.08	 0.85	  1.0	 48	 270	top road
  -0.219123	  -0.520207	      12*	Junct	0.086	 0.11	 0.94	  1.1	 48	 270	top road
- -0.218605	  -0.520090	      -2 	Waypt	0.059	 0.07	 1.00	  1.2	 48	  12	loop 4
+ -0.218605	  -0.520090	      -2 	Waypt#2	0.059	 0.07	 1.00	  1.2	 48	  12	loop 4
  -0.218474	  -0.520060	      14*	Inter	0.015	 0.02	 1.01	  1.2	 48	  12	loop 4
  -0.218258	  -0.519789	      16 	Inter	0.038	 0.05	 1.05	  1.2	 48	  51	loop 4
  -0.218482	  -0.519542	      18*	Inter	0.037	 0.04	 1.09	  1.3	 48	 132	loop 4
@@ -32,4 +32,4 @@
  -0.219107	  -0.520828	       6*	Junct	0.069	 0.09	 1.31	  1.6	 48	 271	top road
  -0.220666	  -0.520893	       5*	Junct-	0.173	 0.11	 1.49	  1.7	 96	 182	main 1
  -0.221308	  -0.520914	       4*	Junct-	0.071	 0.04	 1.56	  1.7	 96	 181	main 1
- -0.221561	  -0.520922	      -3 	Waypt	0.027	 0.02	 1.59	  1.7	 96	 181	main 1
+ -0.221561	  -0.520922	      -3 	Waypt#3	0.027	 0.02	 1.59	  1.7	 96	 181	main 1
diff --git a/src/test/expected/turns-WP11.txt b/src/test/expected/turns-WP11.txt
index 406afcf..994073d 100644
--- a/src/test/expected/turns-WP11.txt
+++ b/src/test/expected/turns-WP11.txt
@@ -4,7 +4,7 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.218453	  -0.520799	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.218453	  -0.520799	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.219107	  -0.520828	       6*	Junct	0.072	 0.04	 0.07	  0.0	 96	 182	main 1
  -0.219123	  -0.520207	      12*	Junct	0.069	 0.09	 0.14	  0.1	 48	  91	top road
  -0.219131	  -0.519426	      20*	Junct	0.086	 0.11	 0.23	  0.2	 48	  90	top road
@@ -24,9 +24,9 @@
  -0.219131	  -0.519426	      20*	Junct	0.067	 0.08	 0.85	  1.0	 48	 270	top road
  -0.218482	  -0.519542	      18*	Inter	0.073	 0.09	 0.93	  1.1	 48	 349	loop 4
  -0.218258	  -0.519789	      16 	Inter	0.037	 0.04	 0.96	  1.1	 48	 312	loop 4
- -0.218474	  -0.520060	      14*	Waypt	0.038	 0.05	 1.00	  1.2	 48	 231	loop 4
+ -0.218474	  -0.520060	      14*	Waypt#2	0.038	 0.05	 1.00	  1.2	 48	 231	loop 4
  -0.219123	  -0.520207	      12*	Junct	0.074	 0.09	 1.07	  1.3	 48	 192	loop 4
  -0.219107	  -0.520828	       6*	Junct	0.069	 0.09	 1.14	  1.4	 48	 271	top road
  -0.220666	  -0.520893	       5*	Junct-	0.173	 0.11	 1.32	  1.5	 96	 182	main 1
  -0.221308	  -0.520914	       4*	Junct-	0.071	 0.04	 1.39	  1.5	 96	 181	main 1
- -0.221561	  -0.520922	      -3 	Waypt	0.027	 0.02	 1.41	  1.5	 96	 181	main 1
+ -0.221561	  -0.520922	      -3 	Waypt#3	0.027	 0.02	 1.41	  1.5	 96	 181	main 1
diff --git a/src/test/expected/turns-WP12.txt b/src/test/expected/turns-WP12.txt
index 2f660d7..c132256 100644
--- a/src/test/expected/turns-WP12.txt
+++ b/src/test/expected/turns-WP12.txt
@@ -4,7 +4,7 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.218453	  -0.520799	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.218453	  -0.520799	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.219107	  -0.520828	       6*	Junct	0.072	 0.04	 0.07	  0.0	 96	 182	main 1
  -0.219123	  -0.520207	      12*	Junct	0.069	 0.09	 0.14	  0.1	 48	  91	top road
  -0.219131	  -0.519426	      20*	Junct	0.086	 0.11	 0.23	  0.2	 48	  90	top road
@@ -23,10 +23,10 @@
  -0.219135	  -0.518823	      23*	Junct	0.133	 0.17	 0.79	  0.9	 48	 270	top road
  -0.219131	  -0.519426	      20*	Junct	0.067	 0.08	 0.85	  1.0	 48	 270	top road
  -0.218482	  -0.519542	      18*	Inter	0.073	 0.09	 0.93	  1.1	 48	 349	loop 4
- -0.218258	  -0.519789	      16 	Waypt	0.037	 0.04	 0.96	  1.1	 48	 312	loop 4
+ -0.218258	  -0.519789	      16 	Waypt#2	0.037	 0.04	 0.96	  1.1	 48	 312	loop 4
  -0.218474	  -0.520060	      14*	Inter	0.038	 0.05	 1.00	  1.2	 48	 231	loop 4
  -0.219123	  -0.520207	      12*	Junct	0.074	 0.09	 1.07	  1.3	 48	 192	loop 4
  -0.219107	  -0.520828	       6*	Junct	0.069	 0.09	 1.14	  1.4	 48	 271	top road
  -0.220666	  -0.520893	       5*	Junct-	0.173	 0.11	 1.32	  1.5	 96	 182	main 1
  -0.221308	  -0.520914	       4*	Junct-	0.071	 0.04	 1.39	  1.5	 96	 181	main 1
- -0.221561	  -0.520922	      -3 	Waypt	0.027	 0.02	 1.41	  1.5	 96	 181	main 1
+ -0.221561	  -0.520922	      -3 	Waypt#3	0.027	 0.02	 1.41	  1.5	 96	 181	main 1
diff --git a/src/test/expected/turns-WP13.txt b/src/test/expected/turns-WP13.txt
index cea2aab..9db94cb 100644
--- a/src/test/expected/turns-WP13.txt
+++ b/src/test/expected/turns-WP13.txt
@@ -4,7 +4,7 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.218453	  -0.520799	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.218453	  -0.520799	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.219107	  -0.520828	       6*	Junct	0.072	 0.04	 0.07	  0.0	 96	 182	main 1
  -0.219123	  -0.520207	      12*	Junct	0.069	 0.09	 0.14	  0.1	 48	  91	top road
  -0.219131	  -0.519426	      20*	Junct	0.086	 0.11	 0.23	  0.2	 48	  90	top road
@@ -23,7 +23,7 @@
  -0.218619	  -0.517921	      32*	Inter	0.067	 0.08	 0.72	  0.8	 48	 330	loop 5
  -0.218431	  -0.518243	      28 	Inter	0.041	 0.05	 0.76	  0.9	 48	 300	loop 5
  -0.218600	  -0.518557	      25*	Inter	0.039	 0.05	 0.80	  0.9	 48	 241	loop 5
- -0.218691	  -0.518602	      -2 	Waypt	0.011	 0.01	 0.81	  1.0	 48	 206	loop 5
+ -0.218691	  -0.518602	      -2 	Waypt#2	0.011	 0.01	 0.81	  1.0	 48	 206	loop 5
  -0.219135	  -0.518823	      23*	Junct	0.054	 0.07	 0.86	  1.0	 48	 206	loop 5
  -0.219145	  -0.517626	      33*	Junct	0.133	 0.17	 1.00	  1.2	 48	  90	top road
  -0.219144	  -0.517257	      36*	Junct	0.041	 0.05	 1.04	  1.2	 48	  89	top road
@@ -42,4 +42,4 @@
  -0.219107	  -0.520828	       6*	Junct	0.069	 0.09	 1.58	  1.9	 48	 271	top road
  -0.220666	  -0.520893	       5*	Junct-	0.173	 0.11	 1.75	  2.0	 96	 182	main 1
  -0.221308	  -0.520914	       4*	Junct-	0.071	 0.04	 1.82	  2.0	 96	 181	main 1
- -0.221561	  -0.520922	      -3 	Waypt	0.027	 0.02	 1.85	  2.1	 96	 181	main 1
+ -0.221561	  -0.520922	      -3 	Waypt#3	0.027	 0.02	 1.85	  2.1	 96	 181	main 1
diff --git a/src/test/expected/turns-WP14.txt b/src/test/expected/turns-WP14.txt
index 8e694cb..6576cc5 100644
--- a/src/test/expected/turns-WP14.txt
+++ b/src/test/expected/turns-WP14.txt
@@ -4,7 +4,7 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.218453	  -0.520799	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.218453	  -0.520799	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.219107	  -0.520828	       6*	Junct	0.072	 0.04	 0.07	  0.0	 96	 182	main 1
  -0.219123	  -0.520207	      12*	Junct	0.069	 0.09	 0.14	  0.1	 48	  91	top road
  -0.219131	  -0.519426	      20*	Junct	0.086	 0.11	 0.23	  0.2	 48	  90	top road
@@ -22,7 +22,7 @@
  -0.219145	  -0.517626	      33*	Junct	0.041	 0.05	 0.65	  0.8	 48	 269	top road
  -0.218619	  -0.517921	      32*	Inter	0.067	 0.08	 0.72	  0.8	 48	 330	loop 5
  -0.218431	  -0.518243	      28 	Inter	0.041	 0.05	 0.76	  0.9	 48	 300	loop 5
- -0.218600	  -0.518557	      25*	Waypt	0.039	 0.05	 0.80	  0.9	 48	 241	loop 5
+ -0.218600	  -0.518557	      25*	Waypt#2	0.039	 0.05	 0.80	  0.9	 48	 241	loop 5
  -0.219135	  -0.518823	      23*	Junct	0.066	 0.08	 0.86	  1.0	 48	 206	loop 5
  -0.219145	  -0.517626	      33*	Junct	0.133	 0.17	 1.00	  1.2	 48	  90	top road
  -0.219144	  -0.517257	      36*	Junct	0.041	 0.05	 1.04	  1.2	 48	  89	top road
@@ -41,4 +41,4 @@
  -0.219107	  -0.520828	       6*	Junct	0.069	 0.09	 1.58	  1.9	 48	 271	top road
  -0.220666	  -0.520893	       5*	Junct-	0.173	 0.11	 1.75	  2.0	 96	 182	main 1
  -0.221308	  -0.520914	       4*	Junct-	0.071	 0.04	 1.82	  2.0	 96	 181	main 1
- -0.221561	  -0.520922	      -3 	Waypt	0.027	 0.02	 1.85	  2.1	 96	 181	main 1
+ -0.221561	  -0.520922	      -3 	Waypt#3	0.027	 0.02	 1.85	  2.1	 96	 181	main 1
diff --git a/src/test/expected/turns-WP15.txt b/src/test/expected/turns-WP15.txt
index 2aa0907..3e9eedd 100644
--- a/src/test/expected/turns-WP15.txt
+++ b/src/test/expected/turns-WP15.txt
@@ -4,7 +4,7 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.218453	  -0.520799	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.218453	  -0.520799	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.219107	  -0.520828	       6*	Junct	0.072	 0.04	 0.07	  0.0	 96	 182	main 1
  -0.219123	  -0.520207	      12*	Junct	0.069	 0.09	 0.14	  0.1	 48	  91	top road
  -0.219131	  -0.519426	      20*	Junct	0.086	 0.11	 0.23	  0.2	 48	  90	top road
@@ -21,7 +21,7 @@
  -0.219144	  -0.517257	      36*	Junct	0.017	 0.02	 0.61	  0.7	 48	 199	roundabout
  -0.219145	  -0.517626	      33*	Junct	0.041	 0.05	 0.65	  0.8	 48	 269	top road
  -0.218619	  -0.517921	      32*	Inter	0.067	 0.08	 0.72	  0.8	 48	 330	loop 5
- -0.218431	  -0.518243	      28 	Waypt	0.041	 0.05	 0.76	  0.9	 48	 300	loop 5
+ -0.218431	  -0.518243	      28 	Waypt#2	0.041	 0.05	 0.76	  0.9	 48	 300	loop 5
  -0.218600	  -0.518557	      25*	Inter	0.039	 0.05	 0.80	  0.9	 48	 241	loop 5
  -0.219135	  -0.518823	      23*	Junct	0.066	 0.08	 0.86	  1.0	 48	 206	loop 5
  -0.219145	  -0.517626	      33*	Junct	0.133	 0.17	 1.00	  1.2	 48	  90	top road
@@ -41,4 +41,4 @@
  -0.219107	  -0.520828	       6*	Junct	0.069	 0.09	 1.58	  1.9	 48	 271	top road
  -0.220666	  -0.520893	       5*	Junct-	0.173	 0.11	 1.75	  2.0	 96	 182	main 1
  -0.221308	  -0.520914	       4*	Junct-	0.071	 0.04	 1.82	  2.0	 96	 181	main 1
- -0.221561	  -0.520922	      -3 	Waypt	0.027	 0.02	 1.85	  2.1	 96	 181	main 1
+ -0.221561	  -0.520922	      -3 	Waypt#3	0.027	 0.02	 1.85	  2.1	 96	 181	main 1
diff --git a/src/test/expected/turns-WP16.txt b/src/test/expected/turns-WP16.txt
index dcc59ae..95fbf05 100644
--- a/src/test/expected/turns-WP16.txt
+++ b/src/test/expected/turns-WP16.txt
@@ -4,13 +4,13 @@
 #
 #Latitude	Longitude	    Node	Type	Segment	Segment	Total	Total  	Speed	Bearing	Highway
 #        	         	        	    	Dist   	Durat'n	Dist 	Durat'n	     	       	       
- -0.218453	  -0.520799	      -1 	Waypt	0.000	 0.00	 0.00	  0.0			
+ -0.218453	  -0.520799	      -1 	Waypt#1	0.000	 0.00	 0.00	  0.0			
  -0.219107	  -0.520828	       6*	Junct-	0.072	 0.04	 0.07	  0.0	 96	 182	main 1
  -0.220666	  -0.520893	       5*	Junct-	0.173	 0.11	 0.24	  0.2	 96	 182	main 1
  -0.221308	  -0.520914	       4*	Junct	0.071	 0.04	 0.32	  0.2	 96	 181	main 1
  -0.221360	  -0.518860	      21*	Junct	0.228	 0.28	 0.54	  0.5	 48	  91	bottom road
- -0.221711	  -0.518511	      26*	Waypt	0.055	 0.07	 0.60	  0.5	 48	 135	loop 6
+ -0.221711	  -0.518511	      26*	Waypt#2	0.055	 0.07	 0.60	  0.5	 48	 135	loop 6
  -0.221376	  -0.518235	      29*	Junct	0.048	 0.06	 0.65	  0.6	 48	  39	loop 6
  -0.221360	  -0.518860	      21*	Junct	0.069	 0.09	 0.72	  0.7	 48	 271	bottom road
  -0.221308	  -0.520914	       4*	Junct	0.228	 0.28	 0.94	  1.0	 48	 271	bottom road
- -0.221561	  -0.520922	      -3 	Waypt	0.027	 0.02	 0.97	  1.0	 96	 181	main 1
+ -0.221561	  -0.520922	      -3 	Waypt#3	0.027	 0.02	 0.97	  1.0	 96	 181	main 1
diff --git a/src/test/loop-and-reverse.osm b/src/test/loop-and-reverse.osm
new file mode 100644
index 0000000..9e7452f
--- /dev/null
+++ b/src/test/loop-and-reverse.osm
@@ -0,0 +1,92 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<osm version='0.6' generator='JOSM'>
+  <node id='376' visible='true' version='1' lat='-0.22066193442' lon='-0.51722838739'>
+    <tag k='name' v='WPmiddle' />
+  </node>
+  <node id='283' visible='true' version='1' lat='-0.21954697776' lon='-0.51390829395'>
+    <tag k='name' v='WPfinish' />
+  </node>
+  <node id='285' visible='true' version='1' lat='-0.21952490241' lon='-0.52113284253'>
+    <tag k='name' v='WPstart' />
+  </node>
+  <node id='311' visible='true' version='1' lat='-0.21896955945' lon='-0.513986122' />
+  <node id='317' visible='true' version='1' lat='-0.21881956658' lon='-0.52097968166' />
+  <node id='341' visible='true' version='1' lat='-0.22081738238' lon='-0.51406217846' />
+  <node id='343' visible='true' version='1' lat='-0.2206667537' lon='-0.52105980937' />
+  <node id='345' visible='true' version='1' lat='-0.22192916245' lon='-0.51433232695' />
+  <node id='347' visible='true' version='1' lat='-0.22194821415' lon='-0.5138620338' />
+  <node id='349' visible='true' version='1' lat='-0.22217484075' lon='-0.51410416422' />
+  <node id='351' visible='true' version='1' lat='-0.22170436926' lon='-0.51409019168' />
+  <node id='353' visible='true' version='1' lat='-0.21801516713' lon='-0.51419094109' />
+  <node id='355' visible='true' version='1' lat='-0.21778030964' lon='-0.51393452606' />
+  <node id='357' visible='true' version='1' lat='-0.21803575222' lon='-0.51369835489' />
+  <node id='359' visible='true' version='1' lat='-0.21827293796' lon='-0.51395410803' />
+  <node id='361' visible='true' version='1' lat='-0.22193543526' lon='-0.52133711536' />
+  <node id='363' visible='true' version='1' lat='-0.22195451857' lon='-0.52086705281' />
+  <node id='365' visible='true' version='1' lat='-0.22219083956' lon='-0.52110835214' />
+  <node id='367' visible='true' version='1' lat='-0.21802147021' lon='-0.52119533493' />
+  <node id='369' visible='true' version='1' lat='-0.21778806953' lon='-0.52093850344' />
+  <node id='371' visible='true' version='1' lat='-0.21804206074' lon='-0.52070275868' />
+  <node id='373' visible='true' version='1' lat='-0.21828070778' lon='-0.52095808001' />
+  <node id='375' visible='true' version='1' lat='-0.22172013801' lon='-0.52109440571' />
+  <way id='383' visible='true' version='1'>
+    <nd ref='317' />
+    <nd ref='311' />
+    <tag k='highway' v='residential' />
+    <tag k='name' v='high street' />
+  </way>
+  <way id='391' visible='true' version='1'>
+    <nd ref='343' />
+    <nd ref='341' />
+    <tag k='highway' v='residential' />
+    <tag k='name' v='low street' />
+  </way>
+  <way id='393' visible='true' version='1'>
+    <nd ref='349' />
+    <nd ref='347' />
+    <nd ref='351' />
+    <nd ref='345' />
+    <nd ref='349' />
+    <tag k='highway' v='primary' />
+  </way>
+  <way id='395' visible='true' version='1'>
+    <nd ref='351' />
+    <nd ref='341' />
+    <nd ref='311' />
+    <nd ref='359' />
+    <tag k='highway' v='primary' />
+    <tag k='name' v='main 2' />
+  </way>
+  <way id='397' visible='true' version='1'>
+    <nd ref='359' />
+    <nd ref='357' />
+    <nd ref='355' />
+    <nd ref='353' />
+    <nd ref='359' />
+    <tag k='highway' v='primary' />
+  </way>
+  <way id='399' visible='true' version='1'>
+    <nd ref='365' />
+    <nd ref='363' />
+    <nd ref='375' />
+    <nd ref='361' />
+    <nd ref='365' />
+    <tag k='highway' v='primary' />
+  </way>
+  <way id='401' visible='true' version='1'>
+    <nd ref='373' />
+    <nd ref='371' />
+    <nd ref='369' />
+    <nd ref='367' />
+    <nd ref='373' />
+    <tag k='highway' v='primary' />
+  </way>
+  <way id='403' visible='true' version='1'>
+    <nd ref='375' />
+    <nd ref='343' />
+    <nd ref='317' />
+    <nd ref='373' />
+    <tag k='highway' v='primary' />
+    <tag k='name' v='main 1' />
+  </way>
+</osm>
diff --git a/src/test/loop-and-reverse.sh b/src/test/loop-and-reverse.sh
new file mode 100755
index 0000000..3133a68
--- /dev/null
+++ b/src/test/loop-and-reverse.sh
@@ -0,0 +1,127 @@
+#!/bin/sh
+
+# Exit on error
+
+set -e
+
+# Test name
+
+name=`basename $0 .sh`
+
+# Slim or non-slim
+
+if [ "$1" = "slim" ]; then
+    slim="-slim"
+    dir="slim"
+else
+    slim=""
+    dir="fat"
+fi
+
+# Libroutino or not libroutino
+
+LD_LIBRARY_PATH=$PWD/..:$LD_LIBRARY_PATH
+export LD_LIBRARY_PATH
+
+if [ "$2" = "lib" ]; then
+    lib="+lib"
+else
+    lib=""
+fi
+
+# Pruned or non-pruned
+
+if [ "$2" = "prune" ]; then
+    prune=""
+    pruned="-pruned"
+else
+    prune="--prune-none"
+    pruned=""
+fi
+
+# Create the output directory
+
+dir=$dir$lib$pruned
+
+[ -d $dir ] || mkdir $dir
+
+# Run the programs under a run-time debugger
+
+debugger=valgrind
+debugger=
+
+# Name related options
+
+osm=$name.osm
+log=$name$lib$slim$pruned.log
+
+option_prefix="--prefix=$name"
+option_dir="--dir=$dir"
+
+# Generic program options
+
+option_planetsplitter="--loggable --tagging=../../xml/routino-tagging.xml --errorlog $prune"
+
+option_filedumper="--dump-osm"
+
+option_router="--profile=motorcar --profiles=../../xml/routino-profiles.xml --translations=copyright.xml"
+
+if [ ! "$2" = "lib" ]; then
+    option_router="$option_router --loggable"
+fi
+
+# Run planetsplitter
+
+echo "Running planetsplitter"
+
+echo ../planetsplitter$slim $option_dir $option_prefix $option_planetsplitter $osm > $log
+$debugger ../planetsplitter$slim $option_dir $option_prefix $option_planetsplitter $osm >> $log
+
+# Run filedumper
+
+echo "Running filedumper"
+
+echo ../filedumper$slim $option_dir $option_prefix $option_filedumper >> $log
+$debugger ../filedumper$slim $option_dir $option_prefix $option_filedumper > $dir/$osm
+
+# Waypoints
+
+waypoints=`perl waypoints.pl $osm list`
+
+waypoint_start=`perl waypoints.pl $osm WPstart 1`
+waypoint_middle=`perl waypoints.pl $osm WPmiddle 2`
+waypoint_finish=`perl waypoints.pl $osm WPfinish 3`
+
+# Run the router for each loop and reverse option
+
+for waypoint in WP WP-L WP-R WP-LR; do
+
+    echo "Running router : $waypoint"
+
+    [ -d $dir/$name-$waypoint ] || mkdir $dir/$name-$waypoint
+
+    option_loop=""
+    option_reverse=""
+
+    case $waypoint in
+        *L*) option_loop="--loop" ;;
+    esac
+
+    case $waypoint in
+        *R*) option_reverse="--reverse" ;;
+    esac
+
+    echo ../router$lib$slim $option_dir $option_prefix $option_osm $option_router $option_loop $option_reverse $waypoint_start $waypoint_middle $waypoint_finish >> $log
+    $debugger ../router$lib$slim $option_dir $option_prefix $option_osm $option_router $option_loop $option_reverse $waypoint_start $waypoint_middle $waypoint_finish >> $log
+
+    mv shortest* $dir/$name-$waypoint
+
+    echo diff -u expected/$name-$waypoint.txt $dir/$name-$waypoint/shortest-all.txt >> $log
+
+    if ./is-fast-math; then
+        diff -U 0 expected/$name-$waypoint.txt $dir/$name-$waypoint/shortest-all.txt | 2>&1 egrep '^[-+] ' || true
+    else
+        diff -u expected/$name-$waypoint.txt $dir/$name-$waypoint/shortest-all.txt >> $log
+    fi
+
+done
diff --git a/src/test/super-or-not.osm b/src/test/super-or-not.osm
index 90ecfb6..0cacb18 100644
--- a/src/test/super-or-not.osm
+++ b/src/test/super-or-not.osm
@@ -1,41 +1,66 @@
 <?xml version='1.0' encoding='UTF-8'?>
-<osm version='0.6' generator='JOSM'>
-  <node id='86' visible='true' version='1' lat='-0.21688045301473516' lon='-0.5151829113120308'>
-    <tag k='name' v='WP02b' />
+<osm version='0.6' upload='true' generator='JOSM'>
+  <node id='58' visible='true' version='1' lat='-0.21702848246' lon='-0.52738775364'>
+    <tag k='name' v='WP05b' />
+  </node>
+  <node id='157' visible='true' version='1' lat='-0.21702799565' lon='-0.52726101675'>
+    <tag k='name' v='WP04a' />
+  </node>
+  <node id='153' visible='true' version='1' lat='-0.21609707601' lon='-0.51589184508'>
+    <tag k='name' v='WP05a' />
   </node>
-  <node id='82' visible='true' version='1' lat='-0.21646963010999992' lon='-0.5174119101486654' />
-  <node id='77' visible='true' version='1' lat='-0.21721431100258048' lon='-0.5141522988242739' />
-  <node id='74' visible='true' version='1' lat='-0.21725785769610798' lon='-0.5202996845787107' />
-  <node id='72' visible='true' version='1' lat='-0.21797637812110027' lon='-0.5199295350232488' />
-  <node id='70' visible='true' version='1' lat='-0.2180562137217683' lon='-0.5149942076170893' />
-  <node id='38' visible='true' version='1' lat='-0.215865729480266' lon='-0.5179307619271613'>
+  <node id='150' visible='true' version='1' lat='-0.21603316931' lon='-0.51583828513'>
+    <tag k='name' v='WP04b' />
+  </node>
+  <node id='147' visible='true' version='1' lat='-0.21633389849' lon='-0.52287240312' />
+  <node id='144' visible='true' version='1' lat='-0.21721592819' lon='-0.52320999057' />
+  <node id='142' visible='true' version='1' lat='-0.21808340301' lon='-0.52354652897' />
+  <node id='140' visible='true' version='1' lat='-0.21803525152' lon='-0.52537629914' />
+  <node id='137' visible='true' version='1' lat='-0.21719656314' lon='-0.52555268966' />
+  <node id='135' visible='true' version='1' lat='-0.21625364598' lon='-0.52582571638' />
+  <node id='133' visible='true' version='1' lat='-0.21620549448' lon='-0.52755918286' />
+  <node id='130' visible='true' version='1' lat='-0.21717586593' lon='-0.52805654727' />
+  <node id='129' visible='true' version='1' lat='-0.21790684752' lon='-0.5284259161' />
+  <node id='38' visible='true' version='1' lat='-0.21586572948' lon='-0.51793076193'>
     <tag k='name' v='WP03b' />
   </node>
-  <node id='39' visible='true' version='1' lat='-0.2164352406236952' lon='-0.5185150361715245' />
-  <node id='40' visible='true' version='1' lat='-0.21645095962829408' lon='-0.5162207323645169' />
-  <node id='41' visible='true' version='1' lat='-0.2159298460869398' lon='-0.5168230480787187' />
-  <node id='42' visible='true' version='1' lat='-0.21724799056850824' lon='-0.5152064339929149' />
-  <node id='43' visible='true' version='1' lat='-0.215918491230658' lon='-0.5190638359247135' />
-  <node id='44' visible='true' version='1' lat='-0.21594107925441666' lon='-0.5156105875143656' />
-  <node id='45' visible='true' version='1' lat='-0.2172454620011612' lon='-0.5196371203012323'>
+  <node id='39' visible='true' version='1' lat='-0.21643524062' lon='-0.51851503617' />
+  <node id='40' visible='true' version='1' lat='-0.21645095963' lon='-0.51622073236' />
+  <node id='41' visible='true' version='1' lat='-0.21592984609' lon='-0.51682304808' />
+  <node id='42' visible='true' version='1' lat='-0.21724799057' lon='-0.51520643399' />
+  <node id='43' visible='true' version='1' lat='-0.21591849123' lon='-0.51906383592' />
+  <node id='44' visible='true' version='1' lat='-0.21594107925' lon='-0.51561058751' />
+  <node id='45' visible='true' version='1' lat='-0.217245462' lon='-0.5196371203'>
     <tag k='name' v='WP03a' />
   </node>
-  <node id='60' visible='true' version='1' lat='-0.21608467422596514' lon='-0.5187345090517225'>
+  <node id='60' visible='true' version='1' lat='-0.21608467423' lon='-0.51873450905'>
     <tag k='name' v='WP01a' />
   </node>
-  <node id='64' visible='true' version='1' lat='-0.21623756439742947' lon='-0.515812981213099'>
+  <node id='64' visible='true' version='1' lat='-0.2162375644' lon='-0.51581298121'>
     <tag k='name' v='WP01b' />
   </node>
-  <node id='340' visible='true' version='1' lat='-0.21686615103763912' lon='-0.5193623107116035'>
+  <node id='70' visible='true' version='1' lat='-0.21805621372' lon='-0.51499420762' />
+  <node id='72' visible='true' version='1' lat='-0.21797637812' lon='-0.51992953502' />
+  <node id='74' visible='true' version='1' lat='-0.21716998323' lon='-0.52876820995' />
+  <node id='77' visible='true' version='1' lat='-0.217214311' lon='-0.51415229882' />
+  <node id='82' visible='true' version='1' lat='-0.21646963011' lon='-0.51741191015' />
+  <node id='86' visible='true' version='1' lat='-0.21688045301' lon='-0.51518291131'>
+    <tag k='name' v='WP02b' />
+  </node>
+  <node id='340' visible='true' version='1' lat='-0.21686615104' lon='-0.51936231071'>
     <tag k='name' v='WP02a' />
   </node>
-  <way id='75' visible='true' version='1'>
-    <nd ref='74' />
-    <nd ref='45' />
-    <nd ref='42' />
-    <nd ref='77' />
-    <tag k='highway' v='primary' />
-    <tag k='name' v='Main road' />
+  <way id='131' visible='true' version='1'>
+    <nd ref='129' />
+    <nd ref='130' />
+    <nd ref='133' />
+    <nd ref='135' />
+    <nd ref='137' />
+    <nd ref='140' />
+    <nd ref='142' />
+    <nd ref='144' />
+    <nd ref='147' />
+    <tag k='highway' v='unclassified' />
   </way>
   <way id='46' visible='true' version='1'>
     <nd ref='72' />
@@ -52,4 +77,15 @@
     <tag k='highway' v='residential' />
     <tag k='name' v='Local road' />
   </way>
+  <way id='75' visible='true' version='1'>
+    <nd ref='74' />
+    <nd ref='130' />
+    <nd ref='137' />
+    <nd ref='144' />
+    <nd ref='45' />
+    <nd ref='42' />
+    <nd ref='77' />
+    <tag k='highway' v='primary' />
+    <tag k='name' v='Main road' />
+  </way>
 </osm>
diff --git a/src/translations.c b/src/translations.c
index 8ca2d5c..0d8ccab 100644
--- a/src/translations.c
+++ b/src/translations.c
@@ -57,7 +57,7 @@ static Translation default_translation=
  .xml_route_shortest = "Shortest",
  .xml_route_quickest = "Quickest",
 
- .html_waypoint   = "<span class='w'>Waypoint</span>", /* span tag added when reading XML translations file */
+ .html_waypoint   = "Waypoint",
  .html_junction   = "Junction",
  .html_roundabout = "Roundabout",
 
@@ -88,10 +88,8 @@ static Translation default_translation=
  .gpx_step  = "%s on '%s' for %.3f km, %.1f min",
  .gpx_final = "Total Journey %.1f km, %.0f minutes",
 
- .gpx_start  = "START",
- .gpx_inter  = "INTER",
+ .gpx_waypt  = "WAYPT",
  .gpx_trip   = "TRIP",
- .gpx_finish = "FINISH"
 };
 
 
@@ -861,8 +859,7 @@ static int HTMLWaypointType_function(const char *_tag_,int _type_,const char *ty
       {
        loaded_translations[nloaded_translations-1]->nothtml_waypoint=strcpy(malloc(strlen(string)+1),string);
 
-       loaded_translations[nloaded_translations-1]->html_waypoint=malloc(strlen(xmlstring)+1+sizeof("<span class='w'>")+sizeof("</span>"));
-       sprintf(loaded_translations[nloaded_translations-1]->html_waypoint,"<span class='w'>%s</span>",xmlstring);
+       loaded_translations[nloaded_translations-1]->html_waypoint=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
       }
     else if(!strcmp(type,"junction"))
       {
@@ -1268,14 +1265,10 @@ static int GPXWaypointType_function(const char *_tag_,int _type_,const char *typ
 
     xmlstring=ParseXML_Encode_Safe_XML(string);
 
-    if(!strcmp(type,"start"))
-       loaded_translations[nloaded_translations-1]->gpx_start=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
-    else if(!strcmp(type,"inter"))
-       loaded_translations[nloaded_translations-1]->gpx_inter=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
+    if(!strcmp(type,"waypt"))
+       loaded_translations[nloaded_translations-1]->gpx_waypt=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
     else if(!strcmp(type,"trip"))
        loaded_translations[nloaded_translations-1]->gpx_trip=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
-    else if(!strcmp(type,"finish"))
-       loaded_translations[nloaded_translations-1]->gpx_finish=strcpy(malloc(strlen(xmlstring)+1),xmlstring);
     else
        XMLPARSE_INVALID(_tag_,type);
    }
@@ -1594,10 +1587,8 @@ void FreeXMLTranslations()
     if(loaded_translations[i]->gpx_step  != default_translation.gpx_step)  free(loaded_translations[i]->gpx_step);
     if(loaded_translations[i]->gpx_final != default_translation.gpx_final) free(loaded_translations[i]->gpx_final);
 
-    if(loaded_translations[i]->gpx_start  != default_translation.gpx_start)  free(loaded_translations[i]->gpx_start);
-    if(loaded_translations[i]->gpx_inter  != default_translation.gpx_inter)  free(loaded_translations[i]->gpx_inter);
+    if(loaded_translations[i]->gpx_waypt  != default_translation.gpx_waypt)  free(loaded_translations[i]->gpx_waypt);
     if(loaded_translations[i]->gpx_trip   != default_translation.gpx_trip)   free(loaded_translations[i]->gpx_trip);
-    if(loaded_translations[i]->gpx_finish != default_translation.gpx_finish) free(loaded_translations[i]->gpx_finish);
 
     free(loaded_translations[i]);
    }
diff --git a/src/translations.h b/src/translations.h
index 8a863ff..a66d1b7 100644
--- a/src/translations.h
+++ b/src/translations.h
@@ -85,10 +85,8 @@ typedef struct _Translation
  char *gpx_step;
  char *gpx_final;
 
- char *gpx_start;
- char *gpx_inter;
+ char *gpx_waypt;
  char *gpx_trip;
- char *gpx_finish;
 }
  Translation;
 
diff --git a/src/typesx.h b/src/typesx.h
index 2febbd2..6694c96 100644
--- a/src/typesx.h
+++ b/src/typesx.h
@@ -3,7 +3,7 @@
 
  Part of the Routino routing software.
  ******************/ /******************
- This file Copyright 2008-2014 Andrew M. Bishop
+ This file Copyright 2008-2016 Andrew M. Bishop
 
  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU Affero General Public License as published by
@@ -65,7 +65,7 @@
 /* Simple Types */
 
 /*+ A node identifier - must be at least as large as index_t. +*/
-typedef uint32_t node_t;
+typedef uint64_t node_t;
 
 /*+ A way identifier - must be at least as large as index_t. +*/
 typedef uint32_t way_t;
@@ -75,7 +75,7 @@ typedef uint32_t relation_t;
 
 
 /*+ A printf formatting string for a node_t type (this should match the node_t definition above). +*/
-#define Pnode_t PRIu32          /* PRIu32 and PRIu64 are defined in intypes.h */
+#define Pnode_t PRIu64          /* PRIu32 and PRIu64 are defined in intypes.h */
 
 /*+ A printf formatting string for a way_t type (this should match the way_t definition above). +*/
 #define Pway_t PRIu32           /* PRIu32 and PRIu64 are defined in intypes.h */
diff --git a/src/version.h b/src/version.h
index deeff25..2d19904 100644
--- a/src/version.h
+++ b/src/version.h
@@ -23,7 +23,7 @@
 #ifndef VERSION_H
 #define VERSION_H    /*+ To stop multiple inclusions. +*/
 
-#define ROUTINO_VERSION "3.0"
+#define ROUTINO_VERSION "3.0+svn"
 
 #define ROUTINO_URL     "<http://www.routino.org/>"
 
diff --git a/src/ways.h b/src/ways.h
index cec3b39..8cd662f 100644
--- a/src/ways.h
+++ b/src/ways.h
@@ -3,7 +3,7 @@
 
  Part of the Routino routing software.
  ******************/ /******************
- This file Copyright 2008-2015 Andrew M. Bishop
+ This file Copyright 2008-2016 Andrew M. Bishop
 
  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU Affero General Public License as published by
@@ -168,28 +168,28 @@ static inline Way *LookupWay(Ways *ways,index_t index,int position)
 
 static inline char *WayName(Ways *ways,Way *wayp)
 {
- int position=(int)(wayp-&ways->cached[-1]);
+ int position=(int)(wayp-ways->cached);
  int n=0;
 
- if(!ways->ncached[position-1])
-    ways->ncached[position-1]=(char*)malloc(64);
+ if(!ways->ncached[position])
+    ways->ncached[position]=(char*)malloc(64);
 
- while(!SlimFetch(ways->fd,ways->ncached[position-1]+n,64,ways->namesoffset+wayp->name+n))
+ while(!SlimFetch(ways->fd,ways->ncached[position]+n,64,ways->namesoffset+wayp->name+n))
    {
     int i;
 
     for(i=n;i<n+64;i++)
-       if(ways->ncached[position-1][i]==0)
+       if(ways->ncached[position][i]==0)
           goto exitloop;
 
     n+=64;
 
-    ways->ncached[position-1]=(char*)realloc((void*)ways->ncached[position-1],n+64);
+    ways->ncached[position]=(char*)realloc((void*)ways->ncached[position],n+64);
    }
 
  exitloop:
 
- return(ways->ncached[position-1]);
+ return(ways->ncached[position]);
 }
 
 #endif
diff --git a/src/xml/Makefile b/src/xml/Makefile
index bd38869..e7ac9b9 100644
--- a/src/xml/Makefile
+++ b/src/xml/Makefile
@@ -24,11 +24,13 @@ include ../../Makefile.conf
 
 # Compilation targets
 
+DEPDIR=.deps
+
 XMLDIR=../../xml
 
 X=$(notdir $(wildcard $(XMLDIR)/*.xsd))
 C=$(foreach f,$(X),$(addsuffix -skeleton.c,$(basename $f)))
-D=$(wildcard .deps/*.d)
+D=$(wildcard $(DEPDIR)/*.d)
 O=$(foreach f,$(C),$(addsuffix .o,$(basename $f)))
 E=$(foreach f,$(C),$(addsuffix $(.EXE),$(basename $f)))
 
@@ -62,8 +64,8 @@ xsd-to-xmlparser$(.EXE) : xsd-to-xmlparser.o ../xmlparse.o
 ########
 
 %.o : %.c
-	@[ -d .deps ] || mkdir .deps
-	$(CC) -c $(CFLAGS) -I.. $< -o $@ -MMD -MP -MF $(addprefix .deps/,$(addsuffix .d,$(basename $@)))
+	-@[ -d $(DEPDIR) ] || mkdir $(DEPDIR)
+	$(CC) -c $(CFLAGS) -I.. $< -o $@ -MMD -MP -MF $(addprefix $(DEPDIR)/,$(addsuffix .d,$(basename $@)))
 
 ########
 
@@ -100,9 +102,9 @@ clean:
 	rm -f *.o
 	rm -f $(EXE)
 	rm -f $(E) test-skeleton$(.EXE)
-	rm -f $(D) .deps/test-skeleton.d
+	rm -f $(D) $(DEPDIR)/test-skeleton.d
 	rm -f $(C) test-skeleton.c
-	rm -fr .deps
+	rm -fr $(DEPDIR)
 	rm -f core
 	rm -f *.gcda *.gcno *.gcov gmon.out
 
diff --git a/src/xmlparse.c b/src/xmlparse.c
index eba82c5..9a05e74 100644
--- a/src/xmlparse.c
+++ b/src/xmlparse.c
@@ -5,7 +5,7 @@
 
  Part of the Routino routing software.
  ******************/ /******************
- This file Copyright 2010-2015 Andrew M. Bishop
+ This file Copyright 2010-2016 Andrew M. Bishop
 
  This program is free software: you can redistribute it and/or modify
  it under the terms of the GNU Affero General Public License as published by
@@ -1032,15 +1032,16 @@ int ParseXML(int fd,const xmltag *const *tags,int options)
    case LEX_FUNC_TAG_POP:
 
     stackused--;
+
+    if(stackused<0)
+       BEGIN(LEX_ERROR_NO_START);
+
     tags=tags_stack[stackused];
     tag =tag_stack [stackused];
 
     if(strcmp((char*)buffer_token,tag->name))
        BEGIN(LEX_ERROR_UNBALANCED);
 
-    if(stackused<0)
-       BEGIN(LEX_ERROR_NO_START);
-
     for(i=0;i<tag->nattributes;i++)
        attributes[i]=NULL;
 
diff --git a/web/Makefile b/web/Makefile
index 84f0ad8..ea23b07 100644
--- a/web/Makefile
+++ b/web/Makefile
@@ -99,7 +99,7 @@ all-doc:
 
 ####
 
-all-profiles: all-exe all-data
+all-profiles: all-bin all-data
 	@if [ ! -f $(WEBWWWDIR)/profiles.js ] || [ ! -f $(WEBWWWDIR)/profiles.pl ] || \
 	     [ $(WEBDATADIR)/profiles.xml -nt $(WEBWWWDIR)/profiles.pl ] || \
 	     [ $(WEBDATADIR)/profiles.xml -nt $(WEBWWWDIR)/profiles.js ]; then \
@@ -158,7 +158,7 @@ $(WEBICONDIR)/ball-0.png: $(WEBICONDIR)/create-icons.pl
 ####
 
 all-exe:
-	cd $(SRCDIR) && $(MAKE) $(EXE_FILES)
+	cd $(SRCDIR) && $(MAKE) all-exe
 
 ####
 
@@ -226,3 +226,5 @@ distclean-all-icons: clean-all-icons
 .PHONY:: clean-all-bin clean-all-data clean-all-doc clean-all-profiles clean-all-translations clean-all-icons
 
 .PHONY:: distclean-all-bin distclean-all-data distclean-all-doc distclean-all-profiles distclean-all-translations distclean-all-icons
+
+.NOTPARALLEL:
diff --git a/web/translations/router.html b/web/translations/router.html
index 125d3e6..ea1998f 100644
--- a/web/translations/router.html
+++ b/web/translations/router.html
@@ -122,9 +122,15 @@
               </div>
             </div>
           </div>
-          <div id="waypoints-buttons" class="center">
-            <input type="button" title="@@WAYPOINT-REVERSE@@" value="@@WAYPOINT-REVERSE-BUTTON@@" onmousedown="markersReverse();">
-            <input type="button" title="@@WAYPOINT-LOOP@@"    value="@@WAYPOINT-LOOP-BUTTON@@"    onmousedown="markersLoop();">
+          <div id="waypoints-buttons">
+            <table>
+              <tr><td>@@WAYPOINT-LOOP-BUTTON@@:   <td><input type="checkbox" name="loop"    onchange="formSetLoopReverse('loop'   );">
+              <tr><td>@@WAYPOINT-REVERSE-BUTTON@@:<td><input type="checkbox" name="reverse" onchange="formSetLoopReverse('reverse');">
+            </table>
+            <div class="waypoint-buttons" style="display: inline-block;">
+              <img src="icons/waypoint-loop.png"    title="@@WAYPOINT-LOOP@@"    onmousedown="markersLoop();">
+              <img src="icons/waypoint-reverse.png" title="@@WAYPOINT-REVERSE@@" onmousedown="markersReverse();">
+            </div>
           </div>
         </div>
       </div>
diff --git a/web/translations/translation.de.txt b/web/translations/translation.de.txt
index b74169b..9cf7721 100644
--- a/web/translations/translation.de.txt
+++ b/web/translations/translation.de.txt
@@ -71,10 +71,8 @@
 %%output-html_total%%	Gesamt %.1f km, %.0f minuten
 %%output-html_subtotal%%	%.1f km, %.0f minuten
 
-%%output-gpx_waypoint_start%%	START
-%%output-gpx_waypoint_inter%%	INTER
-%%output-gpx_waypoint_trip%%	TRIP
-%%output-gpx_waypoint_finish%%	FINISH
+%%output-gpx_waypoint_waypt%%	Wegpunkt
+%%output-gpx_waypoint_trip%%	Reiseroute
 
 %%output-gpx_desc%%	%s Strecke zwischen 'Start' und 'Ziel'
 %%output-gpx_name%%	%s Strecke
@@ -128,7 +126,7 @@
 @@WAYPOINT-SEARCH@@	Nach Ort suchen
 @@WAYPOINT-GET@@	Aktuellen Ort bestimmen
 @@WAYPOINT-CENTRE1@@	Karte auf Wegpunkt zentrieren
-@@WAYPOINT-UP@@	wegpunkt nach oben verschieben
+@@WAYPOINT-UP@@	Wegpunkt nach oben verschieben
 @@WAYPOINT-ADD@@	Neuer Wegpunkt nach diesem
 @@WAYPOINT-COORDS@@	Koordinaten des Orts
 @@WAYPOINT-HOME@@	Umschalten auf den Standort des Zuhauses
@@ -141,7 +139,7 @@
 @@WAYPOINT-LOOP-BUTTON@@	Schleife schließen
 
 @@TRANSPORT-FOOT@@	Fußgänger
-@@TRANSPORT-HORSE@@	Reiter
+@@TRANSPORT-HORSE@@	Pferd
 @@TRANSPORT-WHEELCHAIR@@	Rollstuhl
 @@TRANSPORT-BICYCLE@@	Fahrrad
 @@TRANSPORT-MOPED@@	Moped
@@ -229,6 +227,7 @@
 @@VISUALISER-NUM-ERRORS@@	# Error Logs erstellt
 
 @@JUNCTIONS-BUTTON@@	Kreuzungen anzeigen
+@@JUNCTIONS-1@@	ein Weg - Sackgasse
 @@JUNCTIONS-2@@	Aufeinandertreffen zweier Wege unterschiedlichen Typs.
 @@JUNCTIONS-3@@	Aufeinandertreffen von drei Wegen.
 @@JUNCTIONS-4@@	Aufeinandertreffen von vier Wegen.
@@ -238,10 +237,18 @@
 
 @@SUPER-BUTTON@@	Super-Segments anzeigen
 
+@@WAYTYPE-ONEWAY@@	Einbahnstraßen Segmente
+@@WAYTYPE-ROUNDABOUT@@	Kreisverkehr Segmente
+
 @@TURNS-BUTTON@@	Zeige Abbiegebeschränkungen
+$$TURNS-INFO$$
+Jede Abbiegebeschränkung wird mit einer Linie angezeigt
+$$TURNS-INFO$$
 
 @@SPEED-BUTTON@@	Zeige Geschwindigkeitsbeschränkungen
 
+@@LIMIT-CHANGE@@	Änderung der Beschränkung
+@@LIMIT-NONE@@	Keine Beschränkung
 @@SPEED-LIMIT-80@@	80 km/Stunde Geschwindigkeitsbegrenzung
 
 @@WEIGHT-BUTTON@@	Gewichtswegbeschränkungen anzeigen
@@ -254,6 +261,14 @@
 
 @@WIDTH-BUTTON@@	Maximale Breite anzeigen
 
+@@WIDTH-LIMIT-3@@	max. 3,0 m Breite
+
+@@LENGTH-BUTTON@@	Längenbeschränkung anzeigen
+
+@@LENGTH-LIMIT-9@@	9.0 m Längenbeschränkung
+
+@@ERROR-LOG-BUTTON@@	Anzeige Fehlerprotokoll
+
 @@CLEAR-DATA-BUTTON@@	Daten zurücksetzen
 
 #
@@ -352,3 +367,6 @@ $$ROUTER-VISUALISER-INFO$$
 # Multi-line descriptive translations (visualiser)
 #
 
+$$VISUALISER-ROUTER-INFO$$
+Um die Routenplanung auf der Karte durchzuführen, verwenden sie den untenstehenden Link.
+$$VISUALISER-ROUTER-INFO$$
diff --git a/web/translations/translation.en.txt b/web/translations/translation.en.txt
index d8750bd..534493c 100644
--- a/web/translations/translation.en.txt
+++ b/web/translations/translation.en.txt
@@ -71,10 +71,8 @@
 %%output-html_total%%	Total %.1f km, %.0f minutes
 %%output-html_subtotal%%	%.1f km, %.0f minutes
 
-%%output-gpx_waypoint_start%%	START
-%%output-gpx_waypoint_inter%%	INTER
+%%output-gpx_waypoint_waypt%%	WAYPT
 %%output-gpx_waypoint_trip%%	TRIP
-%%output-gpx_waypoint_finish%%	FINISH
 
 %%output-gpx_desc%%	%s route between 'start' and 'finish' waypoints
 %%output-gpx_name%%	%s route
diff --git a/web/translations/translation.fr.txt b/web/translations/translation.fr.txt
index 91d0fb0..150f17f 100644
--- a/web/translations/translation.fr.txt
+++ b/web/translations/translation.fr.txt
@@ -9,7 +9,7 @@
 %%copyright_creator_string%%	Créateur
 %%copyright_source_string%%	Source
 %%copyright_source_text%%	Basé sur les données OpenStreetMap de http://www.openstreetmap.org/
-%%copyright_license_string%%	License
+%%copyright_license_string%%	Licence
 
 %%turn_-4%%	demi-tour à gauche
 %%turn_-3%%	Très à gauche
@@ -22,7 +22,7 @@
 %%turn_4%%	demi-tour à droite
 
 %%heading_-4%%	Sud
-%%heading_-3%%	Dud-Ouest
+%%heading_-3%%	Sud-Ouest
 %%heading_-2%%	Ouest
 %%heading_-1%%	Nord-Ouest
 %%heading_0%%	Nord
@@ -38,7 +38,7 @@
 %%ordinal_5%%	Cinquième
 %%ordinal_6%%	Sixième
 %%ordinal_7%%	Septième
-%%ordinal_8%%	huitième
+%%ordinal_8%%	Huitième
 %%ordinal_9%%	Neuvième
 %%ordinal_10%%	Dixième
 
@@ -50,8 +50,8 @@
 %%highway_unclassified%%	route non classifiée
 %%highway_residential%%	rue résidentielle
 %%highway_service%%	rue de service
-%%highway_track%%	chemin
-%%highway_cycleway%%	voie cyclable
+%%highway_track%%	piste
+%%highway_cycleway%%	piste cyclable
 %%highway_path%%	sentier
 %%highway_steps%%	escalier
 %%highway_ferry%%	ferry
@@ -59,8 +59,8 @@
 %%route_shortest%%	le plus court
 %%route_quickest%%	le plus rapide
 
-%%output-html_waypoint_waypoint%%	Etape
-%%output-html_waypoint_junction%%	Croisement
+%%output-html_waypoint_waypoint%%	Étape
+%%output-html_waypoint_junction%%	Intersection
 %%output-html_waypoint_roundabout%%	rond-point
 %%output-html_title%%	Itinéraire %s
 %%output-html_start%%	Débute à %s, direction %s
@@ -71,10 +71,7 @@
 %%output-html_total%%	Total %.1f km, %.0f minutes
 %%output-html_subtotal%%	%.1f km, %.0f minutes
 
-%%output-gpx_waypoint_start%%	DEBUT
-%%output-gpx_waypoint_inter%%	INTER
 %%output-gpx_waypoint_trip%%	POINT
-%%output-gpx_waypoint_finish%%	FINAL
 
 %%output-gpx_desc%%	Itinéraire %s entre les étapes 'début' et 'fin'
 %%output-gpx_name%%	Itinéraire %s
@@ -85,8 +82,8 @@
 # Router (and some shared) translations
 #
 
-@@LANGUAGE@@	Francais
-@@LANGUAGE-WEBPAGE@@	Francais
+@@LANGUAGE@@	Français
+@@LANGUAGE-WEBPAGE@@	Page web en français
 
 @@ROUTER-TITLE@@	Calculateur d'itinéraire pour OpenStreetMap
 
@@ -94,17 +91,17 @@
 @@OPTION-TAB-HELP@@	définir les options
 
 @@RESULTS-TAB@@	Résultats
-@@RESULTS-TAB-HELP@@	Voir les resultats
+@@RESULTS-TAB-HELP@@	Voir les résultats
 
 @@DATA-TAB@@	Données
-@@DATA-TAB-HELP@@	Voir les informations de la base de donnée
+@@DATA-TAB-HELP@@	Voir les informations de la base de données
 
-@@ROUTINO-ROUTER@@	Itinéraires pour Openstreetmap Routino
+@@ROUTINO-ROUTER@@	Calculateur d'itinéraires Routino pour Openstreetmap
 @@ROUTINO-WEBSITE@@	site web Routino
 @@DOCUMENTATION@@	Documentation
 
 @@LANGUAGE-BOX@@	Langue
-@@WAYPOINTS-BOX@@	Etapes de l'itinéraire
+@@WAYPOINTS-BOX@@	Étapes de l'itinéraire
 @@TRANSPORT-TYPE-BOX@@	Mode de déplacement
 @@HIGHWAY-PREFERENCES-BOX@@	Préférences routières
 @@SPEED-LIMITS-BOX@@	Limitations de vitesse
@@ -114,15 +111,16 @@
 @@LINKS-BOX@@	Liens
 @@HELP-BOX@@	Aide
 
-@@SHORTEST-ROUTE@@	Le plus court
-@@QUICKEST-ROUTE@@	Le plus rapide
+@@STATUS-BOX@@	État
+@@SHORTEST-ROUTE@@	Itinéraire le plus court
+@@QUICKEST-ROUTE@@	Itinéraire le plus rapide
 
-@@STATISTICS-BOX@@	Routino Statistiques
-@@VISUALISER-BOX@@	Routino Visualiser
+@@STATISTICS-BOX@@	Statistiques de Routino
+@@VISUALISER-BOX@@	Afficheur de Routino
 
-@@WAYPOINT-POSITION@@	Etape XXX de l'itinéraire
-@@WAYPOINT-LONGITUDE@@	Etape XXX Longitude
-@@WAYPOINT-LATITUDE@@	Etape XXX Latitude
+@@WAYPOINT-POSITION@@	Étape XXX de l'itinéraire
+@@WAYPOINT-LONGITUDE@@	Étape XXX Longitude
+@@WAYPOINT-LATITUDE@@	Étape XXX Latitude
 @@WAYPOINT-LOCATION@@	position de l'étape XXX
 @@WAYPOINT-SEARCH@@	Rechercher la position
 @@WAYPOINT-GET@@	obtenir la position actuelle
@@ -143,7 +141,7 @@
 @@TRANSPORT-HORSE@@	À cheval
 @@TRANSPORT-WHEELCHAIR@@	Fauteuil roulant
 @@TRANSPORT-BICYCLE@@	Bicyclette
-@@TRANSPORT-MOPED@@	Mobilette
+@@TRANSPORT-MOPED@@	Cyclomoteur
 @@TRANSPORT-MOTORCYCLE@@	Moto
 @@TRANSPORT-MOTORCAR@@	Voiture
 @@TRANSPORT-GOODS@@	Camionette
@@ -151,15 +149,15 @@
 @@TRANSPORT-PSV@@	Camion(10t)
 
 @@HIGHWAY-MOTORWAY@@	Autoroute
-@@HIGHWAY-TRUNK@@	Trunk
+@@HIGHWAY-TRUNK@@	Voie rapide
 @@HIGHWAY-PRIMARY@@	Primaire
 @@HIGHWAY-SECONDARY@@	Secondaire
 @@HIGHWAY-TERTIARY@@	Tertiaire
 @@HIGHWAY-UNCLASSIFIED@@	Non classée
 @@HIGHWAY-RESIDENTIAL@@	Résidentiel
 @@HIGHWAY-SERVICE@@	Service
-@@HIGHWAY-TRACK@@	Chemin
-@@HIGHWAY-CYCLEWAY@@	Voie cyclable
+@@HIGHWAY-TRACK@@	Piste
+@@HIGHWAY-CYCLEWAY@@	Piste cyclable
 @@HIGHWAY-PATH@@	Sentier
 @@HIGHWAY-STEPS@@	Escaliers
 @@HIGHWAY-FERRY@@	Ferry
@@ -172,7 +170,7 @@
 @@PROPERTY-BICYCLEROUTE@@	Itinér. cycle
 
 @@RESTRICT-ONEWAY@@	Respecter les sens uniques
-@@RESTRICT-TURNS@@	Respecter les obligations de tourner
+@@RESTRICT-TURNS@@	Respecter les interdictions de tourner
 @@RESTRICT-WEIGHT@@	Poids
 @@RESTRICT-HEIGHT@@	Hauteur
 @@RESTRICT-WIDTH@@	Largeur
@@ -188,28 +186,40 @@
 @@ROUTER-RUNNING@@	Routage en cours...
 @@ROUTER-COMPLETED@@	Routage terminé
 @@ROUTER-ERROR@@	Erreur de Routage
-@@ROUTER-FAILED@@	Le Routage n'a pas été lancé correctement
-@@VIEW-DETAILS@@	Voir les Détails
+@@ROUTER-FAILED@@	Le routage n'a pas été lancé correctement
+@@VIEW-DETAILS@@	Voir les détails
 
 @@NO-INFORMATION@@	Pas d'information
 @@HTML-ROUTE@@	Itinéraire HTML
-@@GPX-TRACK-ROUTE@@	Fichier chemin GPX
-@@GPX-ROUTE@@	Fichier route GPX
+@@GPX-TRACK-ROUTE@@	Fichier trace GPX
+@@GPX-ROUTE@@	Fichier itinéraire GPX
 @@FULL-TEXT-ROUTE@@	Fichier texte complet
 @@TEXT-ROUTE@@	Fichier texte
 @@OPEN-POPUP@@	Ouvrir Popup
 
 @@DISPLAY-STATISTICS@@	Afficher les données statistiques
 
-@@JAVASCRIPT-REQUIRED@@	Javascript est <em>nécessaire</em> pour cette page web à cause de la carte intéractive.
+@@JAVASCRIPT-REQUIRED@@	Javascript est <em>nécessaire</em> pour afficher la carte interactive.
 @@ROUTER@@	Routeur
 @@GEO-DATA@@	Geo Data
-@@TILES@@	Tuiles
+@@TILES@@	Dalles
 
 #
 # Visualiser specific translations
 #
 
+@@HEIGHT-LIMIT-4@@	Hauteur limitée à 4,0 m
+
+@@WIDTH-BUTTON@@	Afficher les limites de largeur
+
+@@WIDTH-LIMIT-3@@	Largeur limitée à 3,0 m
+
+@@LENGTH-BUTTON@@	Afficher les limites de longueur
+
+@@LENGTH-LIMIT-9@@	Longueur limitée à 9,0 m
+
+@@ERROR-LOG-BUTTON@@	Afficher le journal des erreurs
+
 #
 # Multi-line descriptive translations (router)
 #
diff --git a/web/translations/translation.hu.txt b/web/translations/translation.hu.txt
index 27f6902..a8b03f8 100644
--- a/web/translations/translation.hu.txt
+++ b/web/translations/translation.hu.txt
@@ -70,7 +70,6 @@
 %%output-html_total%%	Összesen %.1f km, %.0f perc
 %%output-html_subtotal%%	%.1f km, %.0f perc
 
-%%output-gpx_waypoint_start%%	Indulás
 %%output-gpx_waypoint_trip%%	Utazás
 
 %%output-gpx_desc%%	%s útvonal a kezdő és utolsó pont között
diff --git a/web/translations/translation.nl.txt b/web/translations/translation.nl.txt
index 23c4681..af8267a 100644
--- a/web/translations/translation.nl.txt
+++ b/web/translations/translation.nl.txt
@@ -71,11 +71,6 @@
 %%output-html_total%%	Totaal %.1f km, %.0f minuten
 %%output-html_subtotal%%	%.1f km, %.0f minuten
 
-%%output-gpx_waypoint_start%%	START
-%%output-gpx_waypoint_inter%%	INTER
-%%output-gpx_waypoint_trip%%	TRIP
-%%output-gpx_waypoint_finish%%	FINISH
-
 %%output-gpx_desc%%	%s Route tussen 'Start' und 'Finish'
 %%output-gpx_name%%	%s Route
 %%output-gpx_step%%	%s op '%s' voor %.3f km, %.1f min
diff --git a/web/translations/translation.pl.txt b/web/translations/translation.pl.txt
index 3b4c30f..edf77a9 100644
--- a/web/translations/translation.pl.txt
+++ b/web/translations/translation.pl.txt
@@ -68,11 +68,6 @@
 %%output-html_total%%	Całkowity %.1f km, %.0f min.
 %%output-html_subtotal%%	%.1f km, %.0f min.
 
-%%output-gpx_waypoint_start%%	START
-%%output-gpx_waypoint_inter%%	INTER
-%%output-gpx_waypoint_trip%%	TRIP
-%%output-gpx_waypoint_finish%%	KONIEC
-
 %%output-gpx_desc%%	%s trasa pomiędzy 'start' a 'koniec'
 %%output-gpx_name%%	%s trasa
 %%output-gpx_step%%	%s na %s przez %.3f km, %.1f min.
diff --git a/web/translations/translation.ru.txt b/web/translations/translation.ru.txt
index 496f650..98bbb68 100644
--- a/web/translations/translation.ru.txt
+++ b/web/translations/translation.ru.txt
@@ -69,11 +69,6 @@
 %%output-html_total%%	Всего %.1f км, %.0f минут
 %%output-html_subtotal%%	%.1f км, %.0f минут
 
-%%output-gpx_waypoint_start%%	Старт
-%%output-gpx_waypoint_inter%%	INTER
-%%output-gpx_waypoint_trip%%	TRIP
-%%output-gpx_waypoint_finish%%	Финиш
-
 %%output-gpx_desc%%	%s маршрут от 'Старта' до 'Финиша'
 %%output-gpx_name%%	%s маршрут
 %%output-gpx_step%%	на %s по '%s' %.3f км, %.1f мин
diff --git a/web/translations/translations-body.xml b/web/translations/translations-body.xml
index c435fa7..2bb2ccc 100644
--- a/web/translations/translations-body.xml
+++ b/web/translations/translations-body.xml
@@ -79,10 +79,8 @@
 
     <!-- GPX output -->
     <output-gpx>
-      <waypoint type="start" string="%%output-gpx_waypoint_start%%" /> <!-- For the first route waypoint -->
-      <waypoint type="inter" string="%%output-gpx_waypoint_inter%%" /> <!-- For the intermediate route waypoints -->
+      <waypoint type="waypt" string="%%output-gpx_waypoint_waypt%%" /> <!-- For the route waypoints -->
       <waypoint type="trip" string="%%output-gpx_waypoint_trip%%" /> <!-- For the other route points -->
-      <waypoint type="finish" string="%%output-gpx_waypoint_finish%%"/> <!-- For the last route waypoint -->
 
       <desc  text="%%output-gpx_desc%%" /> <!-- %s = [shortest|quickest] -->
       <name  text="%%output-gpx_name%%" /> <!-- %s = [shortest|quickest] -->
diff --git a/web/www/routino/.htaccess b/web/www/routino/.htaccess
index df36362..17e0ea5 100644
--- a/web/www/routino/.htaccess
+++ b/web/www/routino/.htaccess
@@ -3,16 +3,21 @@
 ## Routino CGI scripts.
 ##
 
+# For some of the configuration options in this file to be accepted the
+# 'AllowOverride' option in the main Apache configuration file must be set to a
+# particular value.  A suitable value for the 'AllowOverride' option is
+# 'Options=MultiViews,ExecCGI FileInfo Limit' which will allow this file to be
+# used unmodified.  Alternatively the specific option can be commented out from
+# this file and set in the main Apache configuration file.
+
+
 # The translated router pages use the MultiViews option to serve up a version of
-# the web page depending on the client language preference.  If the line below
-# is used in a .htaccess file like this one and the "AllowOverride none" option
-# is set in the main Apache configuration file then the entry in the .htaccess
-# file will not work.
+# the web page depending on the client language preference.
 
-#Options +MultiViews
+Options +MultiViews
 
 # The English language option will be served if there is no other version
-# present and no errors will be returned to the user in case of problems
+# present and no errors will be returned to the user in case of problems.
 
 LanguagePriority en
 ForceLanguagePriority Prefer Fallback
@@ -24,18 +29,16 @@ ForceLanguagePriority Prefer Fallback
 AddHandler cgi-script .cgi
 
 # The ExecCGI option must be set for the CGIs in this directory to be executed
-# by Apache.  If the line below is used in a .htaccess file like this one and
-# the "AllowOverride none" option is set in the main Apache configuration file
-# then the entry in the .htaccess file will not work.
+# by Apache.
 
-#Options +ExecCGI
+Options +ExecCGI
 
 # The CGI scripts that are used by Routino also call some other Perl scripts, to
 # stop these scripts from being seen by web users they can be denied by the
 # following entry.
 
 <FilesMatch .*\.pl$>
-   Order deny,allow
+   Order Deny,Allow
    Deny from all
 </FilesMatch>
 
diff --git a/web/www/routino/icons/waypoint-loop.png b/web/www/routino/icons/waypoint-loop.png
new file mode 100644
index 0000000..c93e195
Binary files /dev/null and b/web/www/routino/icons/waypoint-loop.png differ
diff --git a/web/www/routino/icons/waypoint-reverse.png b/web/www/routino/icons/waypoint-reverse.png
new file mode 100644
index 0000000..4304381
Binary files /dev/null and b/web/www/routino/icons/waypoint-reverse.png differ
diff --git a/web/www/routino/profiles.js b/web/www/routino/profiles.js
index 0867250..320b66c 100644
--- a/web/www/routino/profiles.js
+++ b/web/www/routino/profiles.js
@@ -28,7 +28,7 @@ var routino={ // contains all default Routino options (generated using "--help-p
         tertiary: { foot:  70, horse:  75, wheelchair:  70, bicycle:  90, moped:  80, motorcycle:  70, motorcar:  70, goods:  70, hgv:  70, psv:  70 },
     unclassified: { foot:  80, horse:  75, wheelchair:  80, bicycle:  90, moped:  70, motorcycle:  60, motorcar:  60, goods:  60, hgv:  60, psv:  60 },
      residential: { foot:  90, horse:  75, wheelchair:  90, bicycle:  90, moped:  60, motorcycle:  50, motorcar:  50, goods:  50, hgv:  50, psv:  50 },
-         service: { foot:  90, horse:  75, wheelchair:  90, bicycle:  90, moped:  80, motorcycle:  80, motorcar:  80, goods:  80, hgv:  80, psv:  80 },
+         service: { foot:  90, horse:  75, wheelchair:  90, bicycle:  90, moped:  50, motorcycle:  40, motorcar:  40, goods:  40, hgv:  40, psv:  40 },
            track: { foot:  95, horse: 100, wheelchair:  95, bicycle:  90, moped:   0, motorcycle:   0, motorcar:   0, goods:   0, hgv:   0, psv:   0 },
         cycleway: { foot:  95, horse:  90, wheelchair:  95, bicycle: 100, moped:   0, motorcycle:   0, motorcar:   0, goods:   0, hgv:   0, psv:   0 },
             path: { foot: 100, horse: 100, wheelchair: 100, bicycle:  90, moped:   0, motorcycle:   0, motorcar:   0, goods:   0, hgv:   0, psv:   0 },
diff --git a/web/www/routino/profiles.pl b/web/www/routino/profiles.pl
index 2479edf..5edb6c8 100644
--- a/web/www/routino/profiles.pl
+++ b/web/www/routino/profiles.pl
@@ -28,7 +28,7 @@ $routino={ # contains all default Routino options (generated using "--help-profi
       tertiary => { foot =>  70,  horse =>  75,  wheelchair =>  70,  bicycle =>  90,  moped =>  80,  motorcycle =>  70,  motorcar =>  70,  goods =>  70,  hgv =>  70,  psv =>  70 },
   unclassified => { foot =>  80,  horse =>  75,  wheelchair =>  80,  bicycle =>  90,  moped =>  70,  motorcycle =>  60,  motorcar =>  60,  goods =>  60,  hgv =>  60,  psv =>  60 },
    residential => { foot =>  90,  horse =>  75,  wheelchair =>  90,  bicycle =>  90,  moped =>  60,  motorcycle =>  50,  motorcar =>  50,  goods =>  50,  hgv =>  50,  psv =>  50 },
-       service => { foot =>  90,  horse =>  75,  wheelchair =>  90,  bicycle =>  90,  moped =>  80,  motorcycle =>  80,  motorcar =>  80,  goods =>  80,  hgv =>  80,  psv =>  80 },
+       service => { foot =>  90,  horse =>  75,  wheelchair =>  90,  bicycle =>  90,  moped =>  50,  motorcycle =>  40,  motorcar =>  40,  goods =>  40,  hgv =>  40,  psv =>  40 },
          track => { foot =>  95,  horse => 100,  wheelchair =>  95,  bicycle =>  90,  moped =>   0,  motorcycle =>   0,  motorcar =>   0,  goods =>   0,  hgv =>   0,  psv =>   0 },
       cycleway => { foot =>  95,  horse =>  90,  wheelchair =>  95,  bicycle => 100,  moped =>   0,  motorcycle =>   0,  motorcar =>   0,  goods =>   0,  hgv =>   0,  psv =>   0 },
           path => { foot => 100,  horse => 100,  wheelchair => 100,  bicycle =>  90,  moped =>   0,  motorcycle =>   0,  motorcar =>   0,  goods =>   0,  hgv =>   0,  psv =>   0 },
diff --git a/web/www/routino/router.css b/web/www/routino/router.css
index cba1b6a..4feb364 100644
--- a/web/www/routino/router.css
+++ b/web/www/routino/router.css
@@ -58,6 +58,7 @@ DIV#tab_options_div DIV.waypoint SPAN
 
 DIV#tab_options_div DIV.waypoint DIV.waypoint-buttons
 {
+ width: 76px;
  float: right;
 }
 
@@ -81,6 +82,29 @@ DIV#tab_options_div DIV#waypoints-buttons
  clear: both;
 }
 
+DIV#tab_options_div DIV#waypoints-buttons TABLE
+{
+ float: left;
+}
+
+DIV#tab_options_div DIV#waypoints-buttons DIV.waypoint-buttons
+{
+ width: 76px;
+ float: right;
+ text-align: center;
+ vertical-align: 50%;
+}
+
+DIV#tab_options_div DIV#waypoints-buttons IMG
+{
+ cursor: pointer;
+}
+
+DIV#tab_options_div DIV#waypoints-buttons IMG:hover
+{
+ background: #F0F000;
+}
+
 DIV#tab_options_div TABLE
 {
  padding: 0;
diff --git a/web/www/routino/router.html.de b/web/www/routino/router.html.de
index 560b026..5fd1502 100644
--- a/web/www/routino/router.html.de
+++ b/web/www/routino/router.html.de
@@ -89,7 +89,7 @@ Wähle Start- und Endpunkt (klicke auf die Marker-Symbole unten), wähle die Rou
 <td>(DE)
 <td><input name="language" type="radio" value="de" onchange="formSetLanguage();" checked>
 <tr>
-<td><a id="lang_fr_url" href="router.html.fr" title="Francais">Francais</a>
+<td><a id="lang_fr_url" href="router.html.fr" title="Page web en français">Français</a>
 <td>(FR)
 <td><input name="language" type="radio" value="fr" onchange="formSetLanguage();" >
 <tr>
@@ -132,7 +132,7 @@ Wähle Start- und Endpunkt (klicke auf die Marker-Symbole unten), wähle die Rou
 <img alt="?" src="icons/waypoint-search.png" title="Nach Ort suchen" onmousedown="markerSearch(XXX);" >
 <img alt="G" src="icons/waypoint-locate.png" title="Aktuellen Ort bestimmen" onmousedown="markerLocate(XXX);" >
 <img alt="O" src="icons/waypoint-recentre.png" title="Karte auf Wegpunkt zentrieren" onmousedown="markerRecentre(XXX);">
-<img alt="^" src="icons/waypoint-up.png" title="wegpunkt nach oben verschieben" onmousedown="markerMoveUp(XXX);" >
+<img alt="^" src="icons/waypoint-up.png" title="Wegpunkt nach oben verschieben" onmousedown="markerMoveUp(XXX);" >
 <img alt="+" src="icons/waypoint-add.png" title="Neuer Wegpunkt nach diesem" onmousedown="markerAddAfter(XXX);">
 <br>
 <img alt="#" src="icons/waypoint-coords.png" title="Koordinaten des Orts" onmousedown="markerCoords(XXX);" >
@@ -145,9 +145,15 @@ Wähle Start- und Endpunkt (klicke auf die Marker-Symbole unten), wähle die Rou
 </div>
 </div>
 </div>
-<div id="waypoints-buttons" class="center">
-<input type="button" title="Rückwärts" value="Rückwärts" onmousedown="markersReverse();">
-<input type="button" title="Einen Wegpunkt hinzufügen um eine Schlaufe zu machen" value="Schleife schließen" onmousedown="markersLoop();">
+<div id="waypoints-buttons">
+<table>
+<tr><td>Schleife schließen: <td><input type="checkbox" name="loop" onchange="formSetLoopReverse('loop' );">
+<tr><td>Rückwärts:<td><input type="checkbox" name="reverse" onchange="formSetLoopReverse('reverse');">
+</table>
+<div class="waypoint-buttons" style="display: inline-block;">
+<img src="icons/waypoint-loop.png" title="Einen Wegpunkt hinzufügen um eine Schlaufe zu machen" onmousedown="markersLoop();">
+<img src="icons/waypoint-reverse.png" title="Rückwärts" onmousedown="markersReverse();">
+</div>
 </div>
 </div>
 </div>
@@ -159,7 +165,7 @@ Wähle Start- und Endpunkt (klicke auf die Marker-Symbole unten), wähle die Rou
 <div id="hideshow_transport_div">
 <table>
 <tr><td>Fußgänger: <td><input name="transport" type="radio" value="foot" onchange="formSetTransport('foot' );">
-<tr><td>Reiter: <td><input name="transport" type="radio" value="horse" onchange="formSetTransport('horse' );">
+<tr><td>Pferd: <td><input name="transport" type="radio" value="horse" onchange="formSetTransport('horse' );">
 <tr><td>Rollstuhl:<td><input name="transport" type="radio" value="wheelchair" onchange="formSetTransport('wheelchair');">
 <tr><td>Fahrrad: <td><input name="transport" type="radio" value="bicycle" onchange="formSetTransport('bicycle' );">
 <tr><td>Moped: <td><input name="transport" type="radio" value="moped" onchange="formSetTransport('moped' );">
diff --git a/web/www/routino/router.html.en b/web/www/routino/router.html.en
index 2700388..a2ad70d 100644
--- a/web/www/routino/router.html.en
+++ b/web/www/routino/router.html.en
@@ -89,7 +89,7 @@ Select start and end points (click on the marker icons below), select routing pr
 <td>(DE)
 <td><input name="language" type="radio" value="de" onchange="formSetLanguage();" >
 <tr>
-<td><a id="lang_fr_url" href="router.html.fr" title="Francais">Francais</a>
+<td><a id="lang_fr_url" href="router.html.fr" title="Page web en français">Français</a>
 <td>(FR)
 <td><input name="language" type="radio" value="fr" onchange="formSetLanguage();" >
 <tr>
@@ -145,9 +145,15 @@ Select start and end points (click on the marker icons below), select routing pr
 </div>
 </div>
 </div>
-<div id="waypoints-buttons" class="center">
-<input type="button" title="Reverse order of waypoints" value="Reverse order" onmousedown="markersReverse();">
-<input type="button" title="Add a new waypoint to make a loop" value="Close loop" onmousedown="markersLoop();">
+<div id="waypoints-buttons">
+<table>
+<tr><td>Close loop: <td><input type="checkbox" name="loop" onchange="formSetLoopReverse('loop' );">
+<tr><td>Reverse order:<td><input type="checkbox" name="reverse" onchange="formSetLoopReverse('reverse');">
+</table>
+<div class="waypoint-buttons" style="display: inline-block;">
+<img src="icons/waypoint-loop.png" title="Add a new waypoint to make a loop" onmousedown="markersLoop();">
+<img src="icons/waypoint-reverse.png" title="Reverse order of waypoints" onmousedown="markersReverse();">
+</div>
 </div>
 </div>
 </div>
diff --git a/web/www/routino/router.html.fr b/web/www/routino/router.html.fr
index 75f9d39..f3c9cd7 100644
--- a/web/www/routino/router.html.fr
+++ b/web/www/routino/router.html.fr
@@ -55,15 +55,15 @@ along with this program. If not, see http://www.gnu.org/licenses/.
 
 <div class="tab_box">
 <span id="tab_options" onclick="tab_select('options');" class="tab_selected" title="définir les options">Options</span>
-<span id="tab_results" onclick="tab_select('results');" class="tab_unselected" title="Voir les resultats">Résultats</span>
-<span id="tab_data" onclick="tab_select('data');" class="tab_unselected" title="Voir les informations de la base de donnée">Données</span>
+<span id="tab_results" onclick="tab_select('results');" class="tab_unselected" title="Voir les résultats">Résultats</span>
+<span id="tab_data" onclick="tab_select('data');" class="tab_unselected" title="Voir les informations de la base de données">Données</span>
 </div>
 
 <div class="tab_content" id="tab_options_div">
 
 <form name="form" id="form" action="#" method="get" onsubmit="return false;">
 <div class="hideshow_box">
-<span class="hideshow_title">Itinéraires pour Openstreetmap Routino</span>
+<span class="hideshow_title">Calculateur d'itinéraires Routino pour Openstreetmap</span>
 Cette page web permet de calculer des itinéraires à l'aide des données collectées par OpenStreetMap.
 Sélectionner les points de départ et d'arrivée (cliquer sur les icones ci-dessous), sélectionner les préférences, puis rechercher un itinéraire.
 <div class="center">
@@ -89,7 +89,7 @@ Sélectionner les points de départ et d'arrivée (cliquer sur les icones ci-des
 <td>(DE)
 <td><input name="language" type="radio" value="de" onchange="formSetLanguage();" >
 <tr>
-<td><a id="lang_fr_url" href="router.html.fr" title="Francais">Francais</a>
+<td><a id="lang_fr_url" href="router.html.fr" title="Page web en français">Français</a>
 <td>(FR)
 <td><input name="language" type="radio" value="fr" onchange="formSetLanguage();" checked>
 <tr>
@@ -116,14 +116,14 @@ Sélectionner les points de départ et d'arrivée (cliquer sur les icones ci-des
 <div class="hideshow_box">
 <span id="hideshow_waypoint_show" onclick="hideshow_show('waypoint');" class="hideshow_hide">+</span>
 <span id="hideshow_waypoint_hide" onclick="hideshow_hide('waypoint');" class="hideshow_show">-</span>
-<span class="hideshow_title">Etapes de l'itinéraire</span>
+<span class="hideshow_title">Étapes de l'itinéraire</span>
 <div id="hideshow_waypoint_div">
 <div id="waypoints">
 <div id="waypointXXX" class="waypoint" style="display: none;">
-<img id="iconXXX" class="waypoint-icon" src="icons/marker-XXX-grey.png" title="Etape XXX de l'itinéraire" alt="Waypoint XXX" onmouseup="markerToggleMap(XXX);" draggable="true">
+<img id="iconXXX" class="waypoint-icon" src="icons/marker-XXX-grey.png" title="Étape XXX de l'itinéraire" alt="Waypoint XXX" onmouseup="markerToggleMap(XXX);" draggable="true">
 <span id="coordsXXX">
-<input name="lonXXX" type="text" size="7" title="Etape XXX Longitude" onchange="formSetCoords(XXX);">E
-<input name="latXXX" type="text" size="7" title="Etape XXX Latitude" onchange="formSetCoords(XXX);">N
+<input name="lonXXX" type="text" size="7" title="Étape XXX Longitude" onchange="formSetCoords(XXX);">E
+<input name="latXXX" type="text" size="7" title="Étape XXX Latitude" onchange="formSetCoords(XXX);">N
 </span>
 <span id="searchXXX" style="display: none;">
 <input name="searchXXX" type="text" size="18" title="position de l'étape XXX"> <!-- uses Javascript event for triggering -->
@@ -145,9 +145,15 @@ Sélectionner les points de départ et d'arrivée (cliquer sur les icones ci-des
 </div>
 </div>
 </div>
-<div id="waypoints-buttons" class="center">
-<input type="button" title="Inverser l'ordre des étapes" value="Inverser l'ordre" onmousedown="markersReverse();">
-<input type="button" title="Ajouter une nouvelle étape pour faire une boucle" value="Faire une boucle" onmousedown="markersLoop();">
+<div id="waypoints-buttons">
+<table>
+<tr><td>Faire une boucle: <td><input type="checkbox" name="loop" onchange="formSetLoopReverse('loop' );">
+<tr><td>Inverser l'ordre:<td><input type="checkbox" name="reverse" onchange="formSetLoopReverse('reverse');">
+</table>
+<div class="waypoint-buttons" style="display: inline-block;">
+<img src="icons/waypoint-loop.png" title="Ajouter une nouvelle étape pour faire une boucle" onmousedown="markersLoop();">
+<img src="icons/waypoint-reverse.png" title="Inverser l'ordre des étapes" onmousedown="markersReverse();">
+</div>
 </div>
 </div>
 </div>
@@ -162,7 +168,7 @@ Sélectionner les points de départ et d'arrivée (cliquer sur les icones ci-des
 <tr><td>À cheval: <td><input name="transport" type="radio" value="horse" onchange="formSetTransport('horse' );">
 <tr><td>Fauteuil roulant:<td><input name="transport" type="radio" value="wheelchair" onchange="formSetTransport('wheelchair');">
 <tr><td>Bicyclette: <td><input name="transport" type="radio" value="bicycle" onchange="formSetTransport('bicycle' );">
-<tr><td>Mobilette: <td><input name="transport" type="radio" value="moped" onchange="formSetTransport('moped' );">
+<tr><td>Cyclomoteur: <td><input name="transport" type="radio" value="moped" onchange="formSetTransport('moped' );">
 <tr><td>Moto:<td><input name="transport" type="radio" value="motorcycle" onchange="formSetTransport('motorcycle');">
 <tr><td>Voiture: <td><input name="transport" type="radio" value="motorcar" onchange="formSetTransport('motorcar' );">
 <tr><td>Camionette: <td><input name="transport" type="radio" value="goods" onchange="formSetTransport('goods' );">
@@ -179,15 +185,15 @@ Sélectionner les points de départ et d'arrivée (cliquer sur les icones ci-des
 <div id="hideshow_highway_div" style="display: none;">
 <table>
 <tr><td>Autoroute: <td><input name="highway-motorway" type="text" size="3" onchange="formSetHighway('motorway' ,'=');"><td>%<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetHighway('motorway' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetHighway('motorway' ,'+');">
-<tr><td>Trunk: <td><input name="highway-trunk" type="text" size="3" onchange="formSetHighway('trunk' ,'=');"><td>%<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetHighway('trunk' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetHighway('trunk' ,'+');">
+<tr><td>Voie rapide: <td><input name="highway-trunk" type="text" size="3" onchange="formSetHighway('trunk' ,'=');"><td>%<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetHighway('trunk' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetHighway('trunk' ,'+');">
 <tr><td>Primaire: <td><input name="highway-primary" type="text" size="3" onchange="formSetHighway('primary' ,'=');"><td>%<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetHighway('primary' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetHighway('primary' ,'+');">
 <tr><td>Secondaire: <td><input name="highway-secondary" type="text" size="3" onchange="formSetHighway('secondary' ,'=');"><td>%<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetHighway('secondary' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetHighway('secondary' ,'+');">
 <tr><td>Tertiaire: <td><input name="highway-tertiary" type="text" size="3" onchange="formSetHighway('tertiary' ,'=');"><td>%<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetHighway('tertiary' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetHighway('tertiary' ,'+');">
 <tr><td>Non classée:<td><input name="highway-unclassified" type="text" size="3" onchange="formSetHighway('unclassified','=');"><td>%<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetHighway('unclassified','-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetHighway('unclassified','+');">
 <tr><td>Résidentiel: <td><input name="highway-residential" type="text" size="3" onchange="formSetHighway('residential' ,'=');"><td>%<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetHighway('residential' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetHighway('residential' ,'+');">
 <tr><td>Service: <td><input name="highway-service" type="text" size="3" onchange="formSetHighway('service' ,'=');"><td>%<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetHighway('service' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetHighway('service' ,'+');">
-<tr><td>Chemin: <td><input name="highway-track" type="text" size="3" onchange="formSetHighway('track' ,'=');"><td>%<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetHighway('track' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetHighway('track' ,'+');">
-<tr><td>Voie cyclable: <td><input name="highway-cycleway" type="text" size="3" onchange="formSetHighway('cycleway' ,'=');"><td>%<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetHighway('cycleway' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetHighway('cycleway' ,'+');">
+<tr><td>Piste: <td><input name="highway-track" type="text" size="3" onchange="formSetHighway('track' ,'=');"><td>%<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetHighway('track' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetHighway('track' ,'+');">
+<tr><td>Piste cyclable: <td><input name="highway-cycleway" type="text" size="3" onchange="formSetHighway('cycleway' ,'=');"><td>%<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetHighway('cycleway' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetHighway('cycleway' ,'+');">
 <tr><td>Sentier: <td><input name="highway-path" type="text" size="3" onchange="formSetHighway('path' ,'=');"><td>%<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetHighway('path' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetHighway('path' ,'+');">
 <tr><td>Escaliers: <td><input name="highway-steps" type="text" size="3" onchange="formSetHighway('steps' ,'=');"><td>%<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetHighway('steps' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetHighway('steps' ,'+');">
 <tr><td>Ferry: <td><input name="highway-ferry" type="text" size="3" onchange="formSetHighway('ferry' ,'=');"><td>%<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetHighway('ferry' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetHighway('ferry' ,'+');">
@@ -202,15 +208,15 @@ Sélectionner les points de départ et d'arrivée (cliquer sur les icones ci-des
 <div id="hideshow_speed_div" style="display: none;">
 <table>
 <tr><td>Autoroute: <td><input name="speed-motorway" type="text" size="3" onchange="formSetSpeed('motorway' ,'=');"><td>km/hr<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetSpeed('motorway' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetSpeed('motorway' ,'+');">
-<tr><td>Trunk: <td><input name="speed-trunk" type="text" size="3" onchange="formSetSpeed('trunk' ,'=');"><td>km/hr<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetSpeed('trunk' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetSpeed('trunk' ,'+');">
+<tr><td>Voie rapide: <td><input name="speed-trunk" type="text" size="3" onchange="formSetSpeed('trunk' ,'=');"><td>km/hr<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetSpeed('trunk' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetSpeed('trunk' ,'+');">
 <tr><td>Primaire: <td><input name="speed-primary" type="text" size="3" onchange="formSetSpeed('primary' ,'=');"><td>km/hr<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetSpeed('primary' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetSpeed('primary' ,'+');">
 <tr><td>Secondaire: <td><input name="speed-secondary" type="text" size="3" onchange="formSetSpeed('secondary' ,'=');"><td>km/hr<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetSpeed('secondary' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetSpeed('secondary' ,'+');">
 <tr><td>Tertiaire: <td><input name="speed-tertiary" type="text" size="3" onchange="formSetSpeed('tertiary' ,'=');"><td>km/hr<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetSpeed('tertiary' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetSpeed('tertiary' ,'+');">
 <tr><td>Non classée:<td><input name="speed-unclassified" type="text" size="3" onchange="formSetSpeed('unclassified','=');"><td>km/hr<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetSpeed('unclassified','-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetSpeed('unclassified','+');">
 <tr><td>Résidentiel: <td><input name="speed-residential" type="text" size="3" onchange="formSetSpeed('residential' ,'=');"><td>km/hr<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetSpeed('residential' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetSpeed('residential' ,'+');">
 <tr><td>Service: <td><input name="speed-service" type="text" size="3" onchange="formSetSpeed('service' ,'=');"><td>km/hr<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetSpeed('service' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetSpeed('service' ,'+');">
-<tr><td>Chemin: <td><input name="speed-track" type="text" size="3" onchange="formSetSpeed('track' ,'=');"><td>km/hr<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetSpeed('track' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetSpeed('track' ,'+');">
-<tr><td>Voie cyclable: <td><input name="speed-cycleway" type="text" size="3" onchange="formSetSpeed('cycleway' ,'=');"><td>km/hr<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetSpeed('cycleway' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetSpeed('cycleway' ,'+');">
+<tr><td>Piste: <td><input name="speed-track" type="text" size="3" onchange="formSetSpeed('track' ,'=');"><td>km/hr<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetSpeed('track' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetSpeed('track' ,'+');">
+<tr><td>Piste cyclable: <td><input name="speed-cycleway" type="text" size="3" onchange="formSetSpeed('cycleway' ,'=');"><td>km/hr<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetSpeed('cycleway' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetSpeed('cycleway' ,'+');">
 <tr><td>Sentier: <td><input name="speed-path" type="text" size="3" onchange="formSetSpeed('path' ,'=');"><td>km/hr<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetSpeed('path' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetSpeed('path' ,'+');">
 <tr><td>Escaliers: <td><input name="speed-steps" type="text" size="3" onchange="formSetSpeed('steps' ,'=');"><td>km/hr<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetSpeed('steps' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetSpeed('steps' ,'+');">
 <tr><td>Ferry: <td><input name="speed-ferry" type="text" size="3" onchange="formSetSpeed('ferry' ,'=');"><td>km/hr<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetSpeed('ferry' ,'-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetSpeed('ferry' ,'+');">
@@ -241,7 +247,7 @@ Sélectionner les points de départ et d'arrivée (cliquer sur les icones ci-des
 <div id="hideshow_restriction_div" style="display: none;">
 <table>
 <tr><td>Respecter les sens uniques:<td><input name="restrict-oneway" type="checkbox" onchange="formSetRestriction('oneway');">
-<tr><td>Respecter les obligations de tourner: <td><input name="restrict-turns" type="checkbox" onchange="formSetRestriction('turns' );">
+<tr><td>Respecter les interdictions de tourner: <td><input name="restrict-turns" type="checkbox" onchange="formSetRestriction('turns' );">
 </table>
 <table>
 <tr><td>Poids:<td><input name="restrict-weight" type="text" size="3" onchange="formSetRestriction('weight','=');"><td>tonnes<td><img alt="<" src="icons/waypoint-left.png" title="-" onmousedown="formSetRestriction('weight','-');">–/+<img alt=">" src="icons/waypoint-right.png" title="+" onmousedown="formSetRestriction('weight','+');">
@@ -254,8 +260,8 @@ Sélectionner les points de départ et d'arrivée (cliquer sur les icones ci-des
 
 <div class="hideshow_box">
 <span class="hideshow_title">Rechercher</span>
-<input type="button" title="Chercher l'itinéraire le plus court" id="shortest" value="Le plus court" onclick="findRoute('shortest');" disabled="disabled">
-<input type="button" title="Chercher l'itinéraire le plus rapide" id="quickest" value="Le plus rapide" onclick="findRoute('quickest');" disabled="disabled">
+<input type="button" title="Chercher l'itinéraire le plus court" id="shortest" value="Itinéraire le plus court" onclick="findRoute('shortest');" disabled="disabled">
+<input type="button" title="Chercher l'itinéraire le plus rapide" id="quickest" value="Itinéraire le plus rapide" onclick="findRoute('quickest');" disabled="disabled">
 </div>
 
 <div class="hideshow_box">
@@ -333,7 +339,7 @@ les restrictions de sens unique (e. pour la marche).
 <div class="tab_content" id="tab_results_div" style="display: none;">
 
 <div class="hideshow_box">
-<span class="hideshow_title">Status</span>
+<span class="hideshow_title">État</span>
 <div id="result_status">
 <div id="result_status_not_run">
 <b><i>Routage non lancé</i></b>
@@ -344,15 +350,15 @@ les restrictions de sens unique (e. pour la marche).
 <div id="result_status_complete" style="display: none;">
 <b>Routage terminé</b>
 <br>
-<a id="router_log_complete" target="router_log" href="#">Voir les Détails</a>
+<a id="router_log_complete" target="router_log" href="#">Voir les détails</a>
 </div>
 <div id="result_status_error" style="display: none;">
 <b>Erreur de Routage</b>
 <br>
-<a id="router_log_error" target="router_log" href="#">Voir les Détails</a>
+<a id="router_log_error" target="router_log" href="#">Voir les détails</a>
 </div>
 <div id="result_status_failed" style="display: none;">
-<b>Le Routage n'a pas été lancé correctement</b>
+<b>Le routage n'a pas été lancé correctement</b>
 </div>
 </div>
 </div>
@@ -360,7 +366,7 @@ les restrictions de sens unique (e. pour la marche).
 <div class="hideshow_box">
 <span id="hideshow_shortest_show" onclick="hideshow_show('shortest');" class="hideshow_show">+</span>
 <span id="hideshow_shortest_hide" onclick="hideshow_hide('shortest');" class="hideshow_hide">-</span>
-<span class="hideshow_title">Le plus court</span>
+<span class="hideshow_title">Itinéraire le plus court</span>
 <div id="shortest_status">
 <div id="shortest_status_no_info">
 <b><i>Pas d'information</i></b>
@@ -372,8 +378,8 @@ les restrictions de sens unique (e. pour la marche).
 <div id="shortest_links" style="display: none;">
 <table>
 <tr><td>Itinéraire HTML: <td><a id="shortest_html" target="shortest_html" href="#">Ouvrir Popup</a>
-<tr><td>Fichier chemin GPX: <td><a id="shortest_gpx_track" target="shortest_gpx_track" href="#">Ouvrir Popup</a>
-<tr><td>Fichier route GPX: <td><a id="shortest_gpx_route" target="shortest_gpx_route" href="#">Ouvrir Popup</a>
+<tr><td>Fichier trace GPX: <td><a id="shortest_gpx_track" target="shortest_gpx_track" href="#">Ouvrir Popup</a>
+<tr><td>Fichier itinéraire GPX: <td><a id="shortest_gpx_route" target="shortest_gpx_route" href="#">Ouvrir Popup</a>
 <tr><td>Fichier texte complet: <td><a id="shortest_text_all" target="shortest_text_all" href="#">Ouvrir Popup</a>
 <tr><td>Fichier texte: <td><a id="shortest_text" target="shortest_text" href="#">Ouvrir Popup</a>
 </table>
@@ -387,7 +393,7 @@ les restrictions de sens unique (e. pour la marche).
 <div class="hideshow_box">
 <span id="hideshow_quickest_show" onclick="hideshow_show('quickest');" class="hideshow_show">+</span>
 <span id="hideshow_quickest_hide" onclick="hideshow_hide('quickest');" class="hideshow_hide">-</span>
-<span class="hideshow_title">Le plus rapide</span>
+<span class="hideshow_title">Itinéraire le plus rapide</span>
 <div id="quickest_status">
 <div id="quickest_status_no_info">
 <b><i>Pas d'information</i></b>
@@ -399,8 +405,8 @@ les restrictions de sens unique (e. pour la marche).
 <div id="quickest_links" style="display: none;">
 <table>
 <tr><td>Itinéraire HTML: <td><a id="quickest_html" target="quickest_html" href="#">Ouvrir Popup</a>
-<tr><td>Fichier chemin GPX: <td><a id="quickest_gpx_track" target="quickest_gpx_track" href="#">Ouvrir Popup</a>
-<tr><td>Fichier route GPX: <td><a id="quickest_gpx_route" target="quickest_gpx_route" href="#">Ouvrir Popup</a>
+<tr><td>Fichier trace GPX: <td><a id="quickest_gpx_track" target="quickest_gpx_track" href="#">Ouvrir Popup</a>
+<tr><td>Fichier itinéraire GPX: <td><a id="quickest_gpx_route" target="quickest_gpx_route" href="#">Ouvrir Popup</a>
 <tr><td>Fichier texte complet: <td><a id="quickest_text_all" target="quickest_text_all" href="#">Ouvrir Popup</a>
 <tr><td>Fichier texte: <td><a id="quickest_text" target="quickest_text" href="#">Ouvrir Popup</a>
 </table>
@@ -456,13 +462,13 @@ entre eux et la distance cumulée pour chaque étape de l'itinéraire.
 
 <div class="tab_content" id="tab_data_div" style="display: none;">
 <div class="hideshow_box">
-<span class="hideshow_title">Routino Statistiques</span>
+<span class="hideshow_title">Statistiques de Routino</span>
 <div id="statistics_data"></div>
 <a id="statistics_link" href="statistics.cgi" onclick="displayStatistics();return(false);">Afficher les données statistiques</a>
 </div>
 
 <div class="hideshow_box">
-<span class="hideshow_title">Routino Visualiser</span>
+<span class="hideshow_title">Afficheur de Routino</span>
 Pour comprendre comment Routino voit les données, il y a un outil de visualisation
 qui permet d'afficher les données soujacentes de multiples manières.
 <br>
@@ -478,7 +484,7 @@ qui permet d'afficher les données soujacentes de multiples manières.
 <div class="map" id="map">
 <noscript>
 <p>
-Javascript est <em>nécessaire</em> pour cette page web à cause de la carte intéractive.
+Javascript est <em>nécessaire</em> pour afficher la carte interactive.
 </noscript>
 </div>
 <div class="attribution">
@@ -486,7 +492,7 @@ Routeur: <a href="http://www.routino.org/" target="routino">Routino</a>
 |
 Geo Data: <span id="attribution_data"></span>
 |
-Tuiles: <span id="attribution_tile"></span>
+Dalles: <span id="attribution_tile"></span>
 </div>
 </div>
 
diff --git a/web/www/routino/router.html.hu b/web/www/routino/router.html.hu
index 2e11ae8..aa3ff0d 100644
--- a/web/www/routino/router.html.hu
+++ b/web/www/routino/router.html.hu
@@ -89,7 +89,7 @@ Select start and end points (click on the marker icons below), select routing pr
 <td>(DE)
 <td><input name="language" type="radio" value="de" onchange="formSetLanguage();" >
 <tr>
-<td><a id="lang_fr_url" href="router.html.fr" title="Francais">Francais</a>
+<td><a id="lang_fr_url" href="router.html.fr" title="Page web en français">Français</a>
 <td>(FR)
 <td><input name="language" type="radio" value="fr" onchange="formSetLanguage();" >
 <tr>
@@ -145,9 +145,15 @@ Select start and end points (click on the marker icons below), select routing pr
 </div>
 </div>
 </div>
-<div id="waypoints-buttons" class="center">
-<input type="button" title="Útirány megfordítása" value="Ellenkező irány" onmousedown="markersReverse();">
-<input type="button" title="Új pont létrehozása a kezdőpontban" value="Kör bezárása" onmousedown="markersLoop();">
+<div id="waypoints-buttons">
+<table>
+<tr><td>Kör bezárása: <td><input type="checkbox" name="loop" onchange="formSetLoopReverse('loop' );">
+<tr><td>Ellenkező irány:<td><input type="checkbox" name="reverse" onchange="formSetLoopReverse('reverse');">
+</table>
+<div class="waypoint-buttons" style="display: inline-block;">
+<img src="icons/waypoint-loop.png" title="Új pont létrehozása a kezdőpontban" onmousedown="markersLoop();">
+<img src="icons/waypoint-reverse.png" title="Útirány megfordítása" onmousedown="markersReverse();">
+</div>
 </div>
 </div>
 </div>
diff --git a/web/www/routino/router.html.nl b/web/www/routino/router.html.nl
index 3e86102..3b736f4 100644
--- a/web/www/routino/router.html.nl
+++ b/web/www/routino/router.html.nl
@@ -90,7 +90,7 @@ icoon links, schuif het op map naar gewenste positie).
 <td>(DE)
 <td><input name="language" type="radio" value="de" onchange="formSetLanguage();" >
 <tr>
-<td><a id="lang_fr_url" href="router.html.fr" title="Francais">Francais</a>
+<td><a id="lang_fr_url" href="router.html.fr" title="Page web en français">Français</a>
 <td>(FR)
 <td><input name="language" type="radio" value="fr" onchange="formSetLanguage();" >
 <tr>
@@ -146,9 +146,15 @@ icoon links, schuif het op map naar gewenste positie).
 </div>
 </div>
 </div>
-<div id="waypoints-buttons" class="center">
-<input type="button" title="Keer volgorde punten om" value="Keer volgorde punten om" onmousedown="markersReverse();">
-<input type="button" title="Add a new waypoint to make a loop" value="Close loop" onmousedown="markersLoop();">
+<div id="waypoints-buttons">
+<table>
+<tr><td>Close loop: <td><input type="checkbox" name="loop" onchange="formSetLoopReverse('loop' );">
+<tr><td>Keer volgorde punten om:<td><input type="checkbox" name="reverse" onchange="formSetLoopReverse('reverse');">
+</table>
+<div class="waypoint-buttons" style="display: inline-block;">
+<img src="icons/waypoint-loop.png" title="Add a new waypoint to make a loop" onmousedown="markersLoop();">
+<img src="icons/waypoint-reverse.png" title="Keer volgorde punten om" onmousedown="markersReverse();">
+</div>
 </div>
 </div>
 </div>
diff --git a/web/www/routino/router.html.pl b/web/www/routino/router.html.pl
index eb2bd1e..13560d9 100644
--- a/web/www/routino/router.html.pl
+++ b/web/www/routino/router.html.pl
@@ -89,7 +89,7 @@ Select start and end points (click on the marker icons below), select routing pr
 <td>(DE)
 <td><input name="language" type="radio" value="de" onchange="formSetLanguage();" >
 <tr>
-<td><a id="lang_fr_url" href="router.html.fr" title="Francais">Francais</a>
+<td><a id="lang_fr_url" href="router.html.fr" title="Page web en français">Français</a>
 <td>(FR)
 <td><input name="language" type="radio" value="fr" onchange="formSetLanguage();" >
 <tr>
@@ -145,9 +145,15 @@ Select start and end points (click on the marker icons below), select routing pr
 </div>
 </div>
 </div>
-<div id="waypoints-buttons" class="center">
-<input type="button" title="Reverse order of waypoints" value="Reverse order" onmousedown="markersReverse();">
-<input type="button" title="Add a new waypoint to make a loop" value="Close loop" onmousedown="markersLoop();">
+<div id="waypoints-buttons">
+<table>
+<tr><td>Close loop: <td><input type="checkbox" name="loop" onchange="formSetLoopReverse('loop' );">
+<tr><td>Reverse order:<td><input type="checkbox" name="reverse" onchange="formSetLoopReverse('reverse');">
+</table>
+<div class="waypoint-buttons" style="display: inline-block;">
+<img src="icons/waypoint-loop.png" title="Add a new waypoint to make a loop" onmousedown="markersLoop();">
+<img src="icons/waypoint-reverse.png" title="Reverse order of waypoints" onmousedown="markersReverse();">
+</div>
 </div>
 </div>
 </div>
diff --git a/web/www/routino/router.html.ru b/web/www/routino/router.html.ru
index ebdc074..4aae6e0 100644
--- a/web/www/routino/router.html.ru
+++ b/web/www/routino/router.html.ru
@@ -89,7 +89,7 @@ Select start and end points (click on the marker icons below), select routing pr
 <td>(DE)
 <td><input name="language" type="radio" value="de" onchange="formSetLanguage();" >
 <tr>
-<td><a id="lang_fr_url" href="router.html.fr" title="Francais">Francais</a>
+<td><a id="lang_fr_url" href="router.html.fr" title="Page web en français">Français</a>
 <td>(FR)
 <td><input name="language" type="radio" value="fr" onchange="formSetLanguage();" >
 <tr>
@@ -145,9 +145,15 @@ Select start and end points (click on the marker icons below), select routing pr
 </div>
 </div>
 </div>
-<div id="waypoints-buttons" class="center">
-<input type="button" title="Reverse order of waypoints" value="Reverse order" onmousedown="markersReverse();">
-<input type="button" title="Add a new waypoint to make a loop" value="Close loop" onmousedown="markersLoop();">
+<div id="waypoints-buttons">
+<table>
+<tr><td>Close loop: <td><input type="checkbox" name="loop" onchange="formSetLoopReverse('loop' );">
+<tr><td>Reverse order:<td><input type="checkbox" name="reverse" onchange="formSetLoopReverse('reverse');">
+</table>
+<div class="waypoint-buttons" style="display: inline-block;">
+<img src="icons/waypoint-loop.png" title="Add a new waypoint to make a loop" onmousedown="markersLoop();">
+<img src="icons/waypoint-reverse.png" title="Reverse order of waypoints" onmousedown="markersReverse();">
+</div>
 </div>
 </div>
 </div>
diff --git a/web/www/routino/router.leaflet.js b/web/www/routino/router.leaflet.js
index 9954ccd..ceb2d7c 100644
--- a/web/www/routino/router.leaflet.js
+++ b/web/www/routino/router.leaflet.js
@@ -83,7 +83,10 @@ var legal={"^lon"             : "^[-0-9.]+$",
            "^width"           : "^[0-9.]+$",
            "^length"          : "^[0-9.]+$",
 
-           "^language"        : "^[-a-zA-Z]+$"};
+           "^language"        : "^[-a-zA-Z]+$",
+
+           "^reverse"         : "(1|0|true|false|on|off)",
+           "^loop"            : "(1|0|true|false|on|off)"};
 
 var args={};
 
@@ -221,6 +224,16 @@ function form_init()            // called from router.html
        searchfield.attachEvent("keyup", searchOnReturnKey); // Internet Explorer
    }
 
+ if(args["loop"] !== undefined)
+    formSetLoopReverse("loop",args["loop"]);
+ else
+    formSetLoopReverse("loop",false);
+
+ if(args["reverse"] !== undefined)
+    formSetLoopReverse("reverse",args["reverse"]);
+ else
+    formSetLoopReverse("reverse",false);
+
  // Update the transport type with the URL settings which updates all HTML forms to defaults.
 
  var transport=routino.transport;
@@ -481,10 +494,9 @@ function formSetRestriction(type,value) // called from router.html (with one arg
  if(type=="oneway" || type=="turns")
    {
     if(value === undefined)
-       routino.profile_restrictions[type][routino.transport]=document.forms["form"].elements["restrict-" + type].checked;
-    else
-       document.forms["form"].elements["restrict-" + type].checked=value;
+       value=document.forms["form"].elements["restrict-" + type].checked;
 
+    document.forms["form"].elements["restrict-" + type].checked=value;
     routino.profile_restrictions[type][routino.transport]=value;
    }
  else if(type=="weight")
@@ -618,6 +630,26 @@ function formSetSearch(marker,search) // called from event handler linked to rou
 
 
 //
+// Change of loop or reverse option in the form
+//
+
+function formSetLoopReverse(type,value) // called from router.html (with one argument)
+{
+ if(value === undefined)
+    value=document.forms["form"].elements[type].checked;
+
+ document.forms["form"].elements[type].checked=value;
+
+ if(type == "loop")
+    routino.loop=value;
+ else
+    routino.reverse=value;
+
+ updateURLs();
+}
+
+
+//
 // Format a number in printf("%.5f") format.
 //
 
@@ -674,6 +706,12 @@ function buildURLArguments(lang)
     if(routino.profile_restrictions[key][routino.transport]!=routino_default.profile_restrictions[key][routino.transport])
        url=url + ";" + key + "=" + routino.profile_restrictions[key][routino.transport];
 
+ if(routino.loop)
+    url=url + ";loop=true";
+
+ if(routino.reverse)
+    url=url + ";reverse=true";
+
  if(lang && routino.language)
     url=url + ";language=" + routino.language;
 
@@ -832,7 +870,7 @@ function map_init()             // called from router.html
 
  icons.home=L.icon({iconUrl: "icons/marker-home-red.png",
                     iconSize: L.point(21,25),
-                    iconAnchor: L.point(11,-25)});
+                    iconAnchor: L.point(10,25)});
 
  // Markers to highlight a selected point
 
@@ -1312,12 +1350,21 @@ function markerLocate(marker)   // called from router.html
 {
  clearSearchResult(marker);
 
+ function success(position)
+ {
+  formSetCoords(marker,position.coords.longitude,position.coords.latitude);
+  markerAddMap(marker);
+ }
+
+ function failure(error)
+ {
+  alert("Error: " + error.message);
+ }
+
  if(navigator.geolocation)
-    navigator.geolocation.getCurrentPosition(
-                                             function(position) {
-                                              formSetCoords(marker,position.coords.longitude,position.coords.latitude);
-                                              markerAddMap(marker);
-                                             });
+    navigator.geolocation.getCurrentPosition(success,failure);
+ else
+    alert("Error: Geolocation unavailable");
 }
 
 
@@ -1403,8 +1450,8 @@ function markerSetClearHome(marker,home)
 
  if(home)
    {
-    homelat=routino.point[marker].lat;
-    homelon=routino.point[marker].lon;
+    homelat=format5f(routino.point[marker].lat);
+    homelon=format5f(routino.point[marker].lon);
 
     cookie="Routino-home=lon:" + homelon + ":lat:" + homelat;
 
@@ -2089,9 +2136,9 @@ function getRouteSuccess(response)
     if(p!=point-1)
        points[p].html += "<tr><td>" + points[p].total;
 
-    result=result + "<tr onmouseover='highlight(\"" + routing_type + "\"," + p + ",\"show\")'>" +
-                    "<td onclick='highlight(\"" + routing_type + "\"," + p + ",\"zoom\")'" +
-                    " class='distance' title='" + points[p].distance + "'>#" + (p+1) +
+    result=result + "<tr onmouseover='highlight(\"" + routing_type + "\"," + p + ",\"show\")' " +
+                    "onclick='highlight(\"" + routing_type + "\"," + p + ",\"zoom\")'>" +
+                    "<td class='distance' title='" + points[p].distance + "'>#" + (p+1) +
                     "<td class='highway'>" + points[p].highway;
    }
 
diff --git a/web/www/routino/router.openlayers.js b/web/www/routino/router.openlayers.js
index 62c8e8c..d951f1e 100644
--- a/web/www/routino/router.openlayers.js
+++ b/web/www/routino/router.openlayers.js
@@ -83,7 +83,10 @@ var legal={"^lon"             : "^[-0-9.]+$",
            "^width"           : "^[0-9.]+$",
            "^length"          : "^[0-9.]+$",
 
-           "^language"        : "^[-a-zA-Z]+$"};
+           "^language"        : "^[-a-zA-Z]+$",
+
+           "^reverse"         : "(1|0|true|false|on|off)",
+           "^loop"            : "(1|0|true|false|on|off)"};
 
 var args={};
 
@@ -221,6 +224,16 @@ function form_init()            // called from router.html
        searchfield.attachEvent("keyup", searchOnReturnKey); // Internet Explorer
    }
 
+ if(args["loop"] !== undefined)
+    formSetLoopReverse("loop",args["loop"]);
+ else
+    formSetLoopReverse("loop",false);
+
+ if(args["reverse"] !== undefined)
+    formSetLoopReverse("reverse",args["reverse"]);
+ else
+    formSetLoopReverse("reverse",false);
+
  // Update the transport type with the URL settings which updates all HTML forms to defaults.
 
  var transport=routino.transport;
@@ -481,10 +494,9 @@ function formSetRestriction(type,value) // called from router.html (with one arg
  if(type=="oneway" || type=="turns")
    {
     if(value === undefined)
-       routino.profile_restrictions[type][routino.transport]=document.forms["form"].elements["restrict-" + type].checked;
-    else
-       document.forms["form"].elements["restrict-" + type].checked=value;
+       value=document.forms["form"].elements["restrict-" + type].checked;
 
+    document.forms["form"].elements["restrict-" + type].checked=value;
     routino.profile_restrictions[type][routino.transport]=value;
    }
  else if(type=="weight")
@@ -621,6 +633,26 @@ function formSetSearch(marker,search) // called from event handler linked to rou
 
 
 //
+// Change of loop or reverse option in the form
+//
+
+function formSetLoopReverse(type,value) // called from router.html (with one argument)
+{
+ if(value === undefined)
+    value=document.forms["form"].elements[type].checked;
+
+ document.forms["form"].elements[type].checked=value;
+
+ if(type == "loop")
+    routino.loop=value;
+ else
+    routino.reverse=value;
+
+ updateURLs();
+}
+
+
+//
 // Format a number in printf("%.5f") format.
 //
 
@@ -677,6 +709,12 @@ function buildURLArguments(lang)
     if(routino.profile_restrictions[key][routino.transport]!=routino_default.profile_restrictions[key][routino.transport])
        url=url + ";" + key + "=" + routino.profile_restrictions[key][routino.transport];
 
+ if(routino.loop)
+    url=url + ";loop=true";
+
+ if(routino.reverse)
+    url=url + ";reverse=true";
+
  if(lang && routino.language)
     url=url + ";language=" + routino.language;
 
@@ -1382,12 +1420,21 @@ function markerLocate(marker)   // called from router.html
 {
  clearSearchResult(marker);
 
+ function success(position)
+ {
+  formSetCoords(marker,position.coords.longitude,position.coords.latitude);
+  markerAddMap(marker);
+ }
+
+ function failure(error)
+ {
+  alert("Error: " + error.message);
+ }
+
  if(navigator.geolocation)
-    navigator.geolocation.getCurrentPosition(
-                                             function(position) {
-                                              formSetCoords(marker,position.coords.longitude,position.coords.latitude);
-                                              markerAddMap(marker);
-                                             });
+    navigator.geolocation.getCurrentPosition(success,failure);
+ else
+    alert("Error: Geolocation unavailable");
 }
 
 
@@ -1473,8 +1520,8 @@ function markerSetClearHome(marker,home)
 
  if(home)
    {
-    homelat=routino.point[marker].lat;
-    homelon=routino.point[marker].lon;
+    homelat=format5f(routino.point[marker].lat);
+    homelon=format5f(routino.point[marker].lon);
 
     cookie="Routino-home=lon:" + homelon + ":lat:" + homelat;
 
@@ -2133,9 +2180,9 @@ function getRouteSuccess(response)
     if(p!=point-1)
        points[p].html += "<tr><td>" + points[p].total;
 
-    result=result + "<tr onmouseover='highlight(\"" + routing_type + "\"," + p + ",\"show\")'>" +
-                    "<td onclick='highlight(\"" + routing_type + "\"," + p + ",\"zoom\")'" +
-                    " class='distance' title='" + points[p].distance + "'>#" + (p+1) +
+    result=result + "<tr onmouseover='highlight(\"" + routing_type + "\"," + p + ",\"show\")' " +
+                    "onclick='highlight(\"" + routing_type + "\"," + p + ",\"zoom\")'>" +
+                    "<td class='distance' title='" + points[p].distance + "'>#" + (p+1) +
                     "<td class='highway'>" + points[p].highway;
    }
 
diff --git a/web/www/routino/router.pl b/web/www/routino/router.pl
index b2d39ba..cda0ab4 100644
--- a/web/www/routino/router.pl
+++ b/web/www/routino/router.pl
@@ -3,7 +3,7 @@
 #
 # Part of the Routino routing software.
 #
-# This file Copyright 2008-2014 Andrew M. Bishop
+# This file Copyright 2008-2015 Andrew M. Bishop
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU Affero General Public License as published by
@@ -69,6 +69,12 @@ sub FillInDefaults
    $params{turns} =~ s/(true|on)/1/;
    $params{turns} =~ s/(false|off)/0/;
 
+   $params{loop} =~ s/(true|on)/1/;
+   $params{loop} =~ s/(false|off)/0/;
+
+   $params{reverse} =~ s/(true|on)/1/;
+   $params{reverse} =~ s/(false|off)/0/;
+
    foreach my $restriction (keys %{$main::routino->{restrictions}})
      {
       my $key="$restriction";
diff --git a/web/www/routino/visualiser.html.de b/web/www/routino/visualiser.html.de
index 53cfc96..b82b0ca 100644
--- a/web/www/routino/visualiser.html.de
+++ b/web/www/routino/visualiser.html.de
@@ -86,7 +86,7 @@ Only data relevant for routing is displayed and some will therefore be excluded.
 <td><a id="lang_de_url" href="visualiser.html.de" title="Deutsche Webseite">Deutsch</a>
 <td>(DE)
 <tr>
-<td><a id="lang_fr_url" href="visualiser.html.fr" title="Francais">Francais</a>
+<td><a id="lang_fr_url" href="visualiser.html.fr" title="Page web en français">Français</a>
 <td>(FR)
 <tr>
 <td><a id="lang_hu_url" href="visualiser.html.hu" title="Magyar weblap">Magyar</a>
@@ -165,7 +165,7 @@ types (or different properties) or a junction where more than two segments
 join are shown colour-coded.
 <br>
 <table>
-<tr><td><img src="icons/ball-1.png" alt="1" ><td>only one highway - a dead-end.
+<tr><td><img src="icons/ball-1.png" alt="1" ><td>ein Weg - Sackgasse
 <tr><td><img src="icons/ball-2.png" alt="2" ><td>Aufeinandertreffen zweier Wege unterschiedlichen Typs.
 <tr><td><img src="icons/ball-3.png" alt="3" ><td>Aufeinandertreffen von drei Wegen.
 <tr><td><img src="icons/ball-4.png" alt="4" ><td>Aufeinandertreffen von vier Wegen.
@@ -196,9 +196,9 @@ shown. For one-way segments a coloured triangle indicates the allowed direction.
 The colours of the triangles depend on the bearing of the highway segment.
 <form name="waytypes" id="waytypes" action="#" method="get" onsubmit="return false;">
 <table>
-<tr><td>One-way segments: <td><input name="waytype" type="radio" value="oneway" onchange="displayData('waytype');" checked>
+<tr><td>Einbahnstraßen Segmente: <td><input name="waytype" type="radio" value="oneway" onchange="displayData('waytype');" checked>
 <tr><td>Cycle-both-way segments:<td><input name="waytype" type="radio" value="cyclebothways" onchange="displayData('waytype');">
-<tr><td>Roundabout segments: <td><input name="waytype" type="radio" value="roundabout" onchange="displayData('waytype');">
+<tr><td>Kreisverkehr Segmente: <td><input name="waytype" type="radio" value="roundabout" onchange="displayData('waytype');">
 </table>
 </form>
 </div>
@@ -239,7 +239,7 @@ Each segment allowed for the chosen type of transport is drawn.
 <form name="transports" id="transports" action="#" method="get" onsubmit="return false;">
 <table>
 <tr><td>Fußgänger: <td><input name="transport" type="radio" value="foot" onchange="displayData('transport');">
-<tr><td>Reiter: <td><input name="transport" type="radio" value="horse" onchange="displayData('transport');">
+<tr><td>Pferd: <td><input name="transport" type="radio" value="horse" onchange="displayData('transport');">
 <tr><td>Rollstuhl:<td><input name="transport" type="radio" value="wheelchair" onchange="displayData('transport');">
 <tr><td>Fahrrad: <td><input name="transport" type="radio" value="bicycle" onchange="displayData('transport');">
 <tr><td>Moped: <td><input name="transport" type="radio" value="moped" onchange="displayData('transport');">
@@ -262,7 +262,7 @@ Each barrier blocking the chosen type of transport is drawn.
 <form name="barriers" id="barriers" action="#" method="get" onsubmit="return false;">
 <table>
 <tr><td>Fußgänger: <td><input name="barrier" type="radio" value="foot" onchange="displayData('barrier');">
-<tr><td>Reiter: <td><input name="barrier" type="radio" value="horse" onchange="displayData('barrier');">
+<tr><td>Pferd: <td><input name="barrier" type="radio" value="horse" onchange="displayData('barrier');">
 <tr><td>Rollstuhl:<td><input name="barrier" type="radio" value="wheelchair" onchange="displayData('barrier');">
 <tr><td>Fahrrad: <td><input name="barrier" type="radio" value="bicycle" onchange="displayData('barrier');">
 <tr><td>Moped: <td><input name="barrier" type="radio" value="moped" onchange="displayData('barrier');">
@@ -281,7 +281,7 @@ Each barrier blocking the chosen type of transport is drawn.
 <span id="hideshow_turns_hide" onclick="hideshow_hide('turns');" class="hideshow_hide">-</span>
 <input type="button" id="turns" onclick="displayData('turns');" value="Zeige Abbiegebeschränkungen">
 <div id="hideshow_turns_div" style="display: none;">
-Each turn restrictions is shown with a line indicating the disallowed turn.
+Jede Abbiegebeschränkung wird mit einer Linie angezeigt
 </div>
 </div>
 
@@ -294,8 +294,8 @@ Each node that joins segments with different speed limits is shown
 along with the speed limit on relevant segments.
 <br>
 <table>
-<tr><td><img src="icons/ball-1.png" alt="." ><td>Change of limit
-<tr><td><img src="icons/limit-no.png" alt="()" ><td>No specified limit
+<tr><td><img src="icons/ball-1.png" alt="." ><td>Änderung der Beschränkung
+<tr><td><img src="icons/limit-no.png" alt="()" ><td>Keine Beschränkung
 <tr><td><img src="icons/limit-80.png" alt="(80)"><td>80 km/Stunde Geschwindigkeitsbegrenzung
 </table>
 </div>
@@ -310,8 +310,8 @@ Each node that joins segments with different weight limits is shown
 along with the weight limit on relevant segments.
 <br>
 <table>
-<tr><td><img src="icons/ball-1.png" alt="." ><td>Change of limit
-<tr><td><img src="icons/limit-no.png" alt="()" ><td>No specified limit
+<tr><td><img src="icons/ball-1.png" alt="." ><td>Änderung der Beschränkung
+<tr><td><img src="icons/limit-no.png" alt="()" ><td>Keine Beschränkung
 <tr><td><img src="icons/limit-8.0.png" alt="(8.0)"><td>8 Tonnen Wegbeschränkung
 </table>
 </div>
@@ -326,8 +326,8 @@ Each node that joins segments with different height limits is shown
 along with the height limit on relevant segments.
 <br>
 <table>
-<tr><td><img src="icons/ball-1.png" alt="." ><td>Change of limit
-<tr><td><img src="icons/limit-no.png" alt="()" ><td>No specified limit
+<tr><td><img src="icons/ball-1.png" alt="." ><td>Änderung der Beschränkung
+<tr><td><img src="icons/limit-no.png" alt="()" ><td>Keine Beschränkung
 <tr><td><img src="icons/limit-4.0.png" alt="(4.0)"><td>4.0 m Höhenbeschränkung
 </table>
 </div>
@@ -342,9 +342,9 @@ Each node that joins segments with different width limits is shown
 along with the width limit on relevant segments.
 <br>
 <table>
-<tr><td><img src="icons/ball-1.png" alt="." ><td>Change of limit
-<tr><td><img src="icons/limit-no.png" alt="()" ><td>No specified limit
-<tr><td><img src="icons/limit-3.0.png" alt="(3.0)"><td>3.0 m width limit
+<tr><td><img src="icons/ball-1.png" alt="." ><td>Änderung der Beschränkung
+<tr><td><img src="icons/limit-no.png" alt="()" ><td>Keine Beschränkung
+<tr><td><img src="icons/limit-3.0.png" alt="(3.0)"><td>max. 3,0 m Breite
 </table>
 </div>
 </div>
@@ -352,15 +352,15 @@ along with the width limit on relevant segments.
 <div class="hideshow_box">
 <span id="hideshow_length_show" onclick="hideshow_show('length');" class="hideshow_show">+</span>
 <span id="hideshow_length_hide" onclick="hideshow_hide('length');" class="hideshow_hide">-</span>
-<input type="button" id="length" onclick="displayData('length');" value="Display Length Limits">
+<input type="button" id="length" onclick="displayData('length');" value="Längenbeschränkung anzeigen">
 <div id="hideshow_length_div" style="display: none;">
 Each node that joins segments with different length limits is shown
 along with the length limit on relevant segments.
 <br>
 <table>
-<tr><td><img src="icons/ball-1.png" alt="." ><td>Change of limit
-<tr><td><img src="icons/limit-no.png" alt="()" ><td>No specified limit
-<tr><td><img src="icons/limit-9.0.png" alt="(9.0)"><td>9.0 m length limit
+<tr><td><img src="icons/ball-1.png" alt="." ><td>Änderung der Beschränkung
+<tr><td><img src="icons/limit-no.png" alt="()" ><td>Keine Beschränkung
+<tr><td><img src="icons/limit-9.0.png" alt="(9.0)"><td>9.0 m Längenbeschränkung
 </table>
 </div>
 </div>
@@ -387,7 +387,7 @@ Each segment of the highways with a particular property is drawn.
 <div class="hideshow_box">
 <span id="hideshow_errorlogs_show" onclick="hideshow_show('errorlogs');" class="hideshow_show">+</span>
 <span id="hideshow_errorlogs_hide" onclick="hideshow_hide('errorlogs');" class="hideshow_hide">-</span>
-<input type="button" id="errorlogs" onclick="displayData('errorlogs');" value="Display Error Logs">
+<input type="button" id="errorlogs" onclick="displayData('errorlogs');" value="Anzeige Fehlerprotokoll">
 <div id="hideshow_errorlogs_div" style="display: none;">
 Potential problems found by Routino when processing the input data.
 </div>
@@ -431,7 +431,7 @@ again.
 <div class="tab_content" id="tab_router_div" style="display: none;">
 <div class="hideshow_box">
 <span class="hideshow_title">Routino Router</span>
-To perform routing on the map use the link below.
+Um die Routenplanung auf der Karte durchzuführen, verwenden sie den untenstehenden Link.
 <br>
 <a id="router_url" href="router.html" target="router">anpassen dieser Kartenansicht</a>
 </div>
diff --git a/web/www/routino/visualiser.html.en b/web/www/routino/visualiser.html.en
index 234be3a..a37cf1e 100644
--- a/web/www/routino/visualiser.html.en
+++ b/web/www/routino/visualiser.html.en
@@ -86,7 +86,7 @@ Only data relevant for routing is displayed and some will therefore be excluded.
 <td><a id="lang_de_url" href="visualiser.html.de" title="Deutsche Webseite">Deutsch</a>
 <td>(DE)
 <tr>
-<td><a id="lang_fr_url" href="visualiser.html.fr" title="Francais">Francais</a>
+<td><a id="lang_fr_url" href="visualiser.html.fr" title="Page web en français">Français</a>
 <td>(FR)
 <tr>
 <td><a id="lang_hu_url" href="visualiser.html.hu" title="Magyar weblap">Magyar</a>
diff --git a/web/www/routino/visualiser.html.fr b/web/www/routino/visualiser.html.fr
index e559ce1..5ea044e 100644
--- a/web/www/routino/visualiser.html.fr
+++ b/web/www/routino/visualiser.html.fr
@@ -62,7 +62,7 @@ along with this program. If not, see http://www.gnu.org/licenses/.
 <div class="tab_content" id="tab_visualiser_div">
 
 <div class="hideshow_box">
-<span class="hideshow_title">Routino Visualiser</span>
+<span class="hideshow_title">Afficheur de Routino</span>
 This web page allows visualisation of the data that Routino uses for routing.
 Only data relevant for routing is displayed and some will therefore be excluded.
 <div class="center">
@@ -86,7 +86,7 @@ Only data relevant for routing is displayed and some will therefore be excluded.
 <td><a id="lang_de_url" href="visualiser.html.de" title="Deutsche Webseite">Deutsch</a>
 <td>(DE)
 <tr>
-<td><a id="lang_fr_url" href="visualiser.html.fr" title="Francais">Francais</a>
+<td><a id="lang_fr_url" href="visualiser.html.fr" title="Page web en français">Français</a>
 <td>(FR)
 <tr>
 <td><a id="lang_hu_url" href="visualiser.html.hu" title="Magyar weblap">Magyar</a>
@@ -112,7 +112,7 @@ server will only return data if the selected area is small enough.
 </div>
 
 <div class="hideshow_box">
-<span class="hideshow_title">Status</span>
+<span class="hideshow_title">État</span>
 <div id="result_status">
 <div id="result_status_no_data">
 <b><i>No data displayed</i></b>
@@ -213,15 +213,15 @@ Each segment of the chosen type of highway is drawn.
 <form name="highways" id="highways" action="#" method="get" onsubmit="return false;">
 <table>
 <tr><td>Autoroute: <td><input name="highway" type="radio" value="motorway" onchange="displayData('highway');">
-<tr><td>Trunk: <td><input name="highway" type="radio" value="trunk" onchange="displayData('highway');">
+<tr><td>Voie rapide: <td><input name="highway" type="radio" value="trunk" onchange="displayData('highway');">
 <tr><td>Primaire: <td><input name="highway" type="radio" value="primary" onchange="displayData('highway');" checked>
 <tr><td>Secondaire: <td><input name="highway" type="radio" value="secondary" onchange="displayData('highway');">
 <tr><td>Tertiaire: <td><input name="highway" type="radio" value="tertiary" onchange="displayData('highway');">
 <tr><td>Non classée:<td><input name="highway" type="radio" value="unclassified" onchange="displayData('highway');">
 <tr><td>Résidentiel: <td><input name="highway" type="radio" value="residential" onchange="displayData('highway');">
 <tr><td>Service: <td><input name="highway" type="radio" value="service" onchange="displayData('highway');">
-<tr><td>Chemin: <td><input name="highway" type="radio" value="track" onchange="displayData('highway');">
-<tr><td>Voie cyclable: <td><input name="highway" type="radio" value="cycleway" onchange="displayData('highway');">
+<tr><td>Piste: <td><input name="highway" type="radio" value="track" onchange="displayData('highway');">
+<tr><td>Piste cyclable: <td><input name="highway" type="radio" value="cycleway" onchange="displayData('highway');">
 <tr><td>Sentier: <td><input name="highway" type="radio" value="path" onchange="displayData('highway');">
 <tr><td>Escaliers: <td><input name="highway" type="radio" value="steps" onchange="displayData('highway');">
 <tr><td>Ferry: <td><input name="highway" type="radio" value="ferry" onchange="displayData('highway');">
@@ -242,7 +242,7 @@ Each segment allowed for the chosen type of transport is drawn.
 <tr><td>À cheval: <td><input name="transport" type="radio" value="horse" onchange="displayData('transport');">
 <tr><td>Fauteuil roulant:<td><input name="transport" type="radio" value="wheelchair" onchange="displayData('transport');">
 <tr><td>Bicyclette: <td><input name="transport" type="radio" value="bicycle" onchange="displayData('transport');">
-<tr><td>Mobilette: <td><input name="transport" type="radio" value="moped" onchange="displayData('transport');">
+<tr><td>Cyclomoteur: <td><input name="transport" type="radio" value="moped" onchange="displayData('transport');">
 <tr><td>Moto:<td><input name="transport" type="radio" value="motorcycle" onchange="displayData('transport');">
 <tr><td>Voiture: <td><input name="transport" type="radio" value="motorcar" onchange="displayData('transport');" checked>
 <tr><td>Camionette: <td><input name="transport" type="radio" value="goods" onchange="displayData('transport');">
@@ -265,7 +265,7 @@ Each barrier blocking the chosen type of transport is drawn.
 <tr><td>À cheval: <td><input name="barrier" type="radio" value="horse" onchange="displayData('barrier');">
 <tr><td>Fauteuil roulant:<td><input name="barrier" type="radio" value="wheelchair" onchange="displayData('barrier');">
 <tr><td>Bicyclette: <td><input name="barrier" type="radio" value="bicycle" onchange="displayData('barrier');">
-<tr><td>Mobilette: <td><input name="barrier" type="radio" value="moped" onchange="displayData('barrier');">
+<tr><td>Cyclomoteur: <td><input name="barrier" type="radio" value="moped" onchange="displayData('barrier');">
 <tr><td>Moto:<td><input name="barrier" type="radio" value="motorcycle" onchange="displayData('barrier');">
 <tr><td>Voiture: <td><input name="barrier" type="radio" value="motorcar" onchange="displayData('barrier');" checked>
 <tr><td>Camionette: <td><input name="barrier" type="radio" value="goods" onchange="displayData('barrier');">
@@ -328,7 +328,7 @@ along with the height limit on relevant segments.
 <table>
 <tr><td><img src="icons/ball-1.png" alt="." ><td>Change of limit
 <tr><td><img src="icons/limit-no.png" alt="()" ><td>No specified limit
-<tr><td><img src="icons/limit-4.0.png" alt="(4.0)"><td>4.0 m height limit
+<tr><td><img src="icons/limit-4.0.png" alt="(4.0)"><td>Hauteur limitée à 4,0 m
 </table>
 </div>
 </div>
@@ -336,7 +336,7 @@ along with the height limit on relevant segments.
 <div class="hideshow_box">
 <span id="hideshow_width_show" onclick="hideshow_show('width');" class="hideshow_show">+</span>
 <span id="hideshow_width_hide" onclick="hideshow_hide('width');" class="hideshow_hide">-</span>
-<input type="button" id="width" onclick="displayData('width');" value="Display Width Limits">
+<input type="button" id="width" onclick="displayData('width');" value="Afficher les limites de largeur">
 <div id="hideshow_width_div" style="display: none;">
 Each node that joins segments with different width limits is shown
 along with the width limit on relevant segments.
@@ -344,7 +344,7 @@ along with the width limit on relevant segments.
 <table>
 <tr><td><img src="icons/ball-1.png" alt="." ><td>Change of limit
 <tr><td><img src="icons/limit-no.png" alt="()" ><td>No specified limit
-<tr><td><img src="icons/limit-3.0.png" alt="(3.0)"><td>3.0 m width limit
+<tr><td><img src="icons/limit-3.0.png" alt="(3.0)"><td>Largeur limitée à 3,0 m
 </table>
 </div>
 </div>
@@ -352,7 +352,7 @@ along with the width limit on relevant segments.
 <div class="hideshow_box">
 <span id="hideshow_length_show" onclick="hideshow_show('length');" class="hideshow_show">+</span>
 <span id="hideshow_length_hide" onclick="hideshow_hide('length');" class="hideshow_hide">-</span>
-<input type="button" id="length" onclick="displayData('length');" value="Display Length Limits">
+<input type="button" id="length" onclick="displayData('length');" value="Afficher les limites de longueur">
 <div id="hideshow_length_div" style="display: none;">
 Each node that joins segments with different length limits is shown
 along with the length limit on relevant segments.
@@ -360,7 +360,7 @@ along with the length limit on relevant segments.
 <table>
 <tr><td><img src="icons/ball-1.png" alt="." ><td>Change of limit
 <tr><td><img src="icons/limit-no.png" alt="()" ><td>No specified limit
-<tr><td><img src="icons/limit-9.0.png" alt="(9.0)"><td>9.0 m length limit
+<tr><td><img src="icons/limit-9.0.png" alt="(9.0)"><td>Longueur limitée à 9,0 m
 </table>
 </div>
 </div>
@@ -387,7 +387,7 @@ Each segment of the highways with a particular property is drawn.
 <div class="hideshow_box">
 <span id="hideshow_errorlogs_show" onclick="hideshow_show('errorlogs');" class="hideshow_show">+</span>
 <span id="hideshow_errorlogs_hide" onclick="hideshow_hide('errorlogs');" class="hideshow_hide">-</span>
-<input type="button" id="errorlogs" onclick="displayData('errorlogs');" value="Display Error Logs">
+<input type="button" id="errorlogs" onclick="displayData('errorlogs');" value="Afficher le journal des erreurs">
 <div id="hideshow_errorlogs_div" style="display: none;">
 Potential problems found by Routino when processing the input data.
 </div>
@@ -439,7 +439,7 @@ To perform routing on the map use the link below.
 
 <div class="tab_content" id="tab_data_div" style="display: none;">
 <div class="hideshow_box">
-<span class="hideshow_title">Routino Statistiques</span>
+<span class="hideshow_title">Statistiques de Routino</span>
 <div id="statistics_data"></div>
 <a id="statistics_link" href="statistics.cgi" onclick="displayStatistics();return(false);">Afficher les données statistiques</a>
 </div>
@@ -453,7 +453,7 @@ To perform routing on the map use the link below.
 <div class="map" id="map">
 <noscript>
 <p>
-Javascript est <em>nécessaire</em> pour cette page web à cause de la carte intéractive.
+Javascript est <em>nécessaire</em> pour afficher la carte interactive.
 </noscript>
 </div>
 <div class="attribution">
@@ -461,7 +461,7 @@ Routeur: <a href="http://www.routino.org/" target="routino">Routino</a>
 |
 Geo Data: <span id="attribution_data"></span>
 |
-Tuiles: <span id="attribution_tile"></span>
+Dalles: <span id="attribution_tile"></span>
 </div>
 </div>
 
diff --git a/web/www/routino/visualiser.html.hu b/web/www/routino/visualiser.html.hu
index 82fa7ee..f35fbd3 100644
--- a/web/www/routino/visualiser.html.hu
+++ b/web/www/routino/visualiser.html.hu
@@ -86,7 +86,7 @@ Only data relevant for routing is displayed and some will therefore be excluded.
 <td><a id="lang_de_url" href="visualiser.html.de" title="Deutsche Webseite">Deutsch</a>
 <td>(DE)
 <tr>
-<td><a id="lang_fr_url" href="visualiser.html.fr" title="Francais">Francais</a>
+<td><a id="lang_fr_url" href="visualiser.html.fr" title="Page web en français">Français</a>
 <td>(FR)
 <tr>
 <td><a id="lang_hu_url" href="visualiser.html.hu" title="Magyar weblap">Magyar</a>
diff --git a/web/www/routino/visualiser.html.nl b/web/www/routino/visualiser.html.nl
index dc5c550..f6f6002 100644
--- a/web/www/routino/visualiser.html.nl
+++ b/web/www/routino/visualiser.html.nl
@@ -86,7 +86,7 @@ Only data relevant for routing is displayed and some will therefore be excluded.
 <td><a id="lang_de_url" href="visualiser.html.de" title="Deutsche Webseite">Deutsch</a>
 <td>(DE)
 <tr>
-<td><a id="lang_fr_url" href="visualiser.html.fr" title="Francais">Francais</a>
+<td><a id="lang_fr_url" href="visualiser.html.fr" title="Page web en français">Français</a>
 <td>(FR)
 <tr>
 <td><a id="lang_hu_url" href="visualiser.html.hu" title="Magyar weblap">Magyar</a>
diff --git a/web/www/routino/visualiser.html.pl b/web/www/routino/visualiser.html.pl
index c44f8f3..25c1717 100644
--- a/web/www/routino/visualiser.html.pl
+++ b/web/www/routino/visualiser.html.pl
@@ -86,7 +86,7 @@ Only data relevant for routing is displayed and some will therefore be excluded.
 <td><a id="lang_de_url" href="visualiser.html.de" title="Deutsche Webseite">Deutsch</a>
 <td>(DE)
 <tr>
-<td><a id="lang_fr_url" href="visualiser.html.fr" title="Francais">Francais</a>
+<td><a id="lang_fr_url" href="visualiser.html.fr" title="Page web en français">Français</a>
 <td>(FR)
 <tr>
 <td><a id="lang_hu_url" href="visualiser.html.hu" title="Magyar weblap">Magyar</a>
diff --git a/web/www/routino/visualiser.html.ru b/web/www/routino/visualiser.html.ru
index 659158e..7970284 100644
--- a/web/www/routino/visualiser.html.ru
+++ b/web/www/routino/visualiser.html.ru
@@ -86,7 +86,7 @@ Only data relevant for routing is displayed and some will therefore be excluded.
 <td><a id="lang_de_url" href="visualiser.html.de" title="Deutsche Webseite">Deutsch</a>
 <td>(DE)
 <tr>
-<td><a id="lang_fr_url" href="visualiser.html.fr" title="Francais">Francais</a>
+<td><a id="lang_fr_url" href="visualiser.html.fr" title="Page web en français">Français</a>
 <td>(FR)
 <tr>
 <td><a id="lang_hu_url" href="visualiser.html.hu" title="Magyar weblap">Magyar</a>
diff --git a/xml/routino-profiles.xml b/xml/routino-profiles.xml
index 40c0aad..25fef45 100644
--- a/xml/routino-profiles.xml
+++ b/xml/routino-profiles.xml
@@ -5,7 +5,7 @@
 
      Part of the Routino routing software.
      ============================================================
-     This file Copyright 2010-2014 Andrew M. Bishop
+     This file Copyright 2010-2015 Andrew M. Bishop
 
      This program is free software: you can redistribute it and/or modify
      it under the terms of the GNU Affero General Public License as published by
@@ -236,7 +236,7 @@
       <preference highway="tertiary"      percent="80" />
       <preference highway="unclassified"  percent="70" />
       <preference highway="residential"   percent="60" />
-      <preference highway="service"       percent="80" />
+      <preference highway="service"       percent="50" />
       <preference highway="track"         percent="0" />
       <preference highway="cycleway"      percent="0" />
       <preference highway="path"          percent="0" />
@@ -285,7 +285,7 @@
       <preference highway="tertiary"      percent="70" />
       <preference highway="unclassified"  percent="60" />
       <preference highway="residential"   percent="50" />
-      <preference highway="service"       percent="80" />
+      <preference highway="service"       percent="40" />
       <preference highway="track"         percent="0" />
       <preference highway="cycleway"      percent="0" />
       <preference highway="path"          percent="0" />
@@ -334,7 +334,7 @@
       <preference highway="tertiary"      percent="70" />
       <preference highway="unclassified"  percent="60" />
       <preference highway="residential"   percent="50" />
-      <preference highway="service"       percent="80" />
+      <preference highway="service"       percent="40" />
       <preference highway="track"         percent="0" />
       <preference highway="cycleway"      percent="0" />
       <preference highway="path"          percent="0" />
@@ -383,7 +383,7 @@
       <preference highway="tertiary"      percent="70" />
       <preference highway="unclassified"  percent="60" />
       <preference highway="residential"   percent="50" />
-      <preference highway="service"       percent="80" />
+      <preference highway="service"       percent="40" />
       <preference highway="track"         percent="0" />
       <preference highway="cycleway"      percent="0" />
       <preference highway="path"          percent="0" />
@@ -432,7 +432,7 @@
       <preference highway="tertiary"      percent="70" />
       <preference highway="unclassified"  percent="60" />
       <preference highway="residential"   percent="50" />
-      <preference highway="service"       percent="80" />
+      <preference highway="service"       percent="40" />
       <preference highway="track"         percent="0" />
       <preference highway="cycleway"      percent="0" />
       <preference highway="path"          percent="0" />
@@ -481,7 +481,7 @@
       <preference highway="tertiary"      percent="70" />
       <preference highway="unclassified"  percent="60" />
       <preference highway="residential"   percent="50" />
-      <preference highway="service"       percent="80" />
+      <preference highway="service"       percent="40" />
       <preference highway="track"         percent="0" />
       <preference highway="cycleway"      percent="0" />
       <preference highway="path"          percent="0" />
diff --git a/xml/routino-translations.xml b/xml/routino-translations.xml
index e1f2b35..c4e9472 100644
--- a/xml/routino-translations.xml
+++ b/xml/routino-translations.xml
@@ -97,10 +97,8 @@
 
     <!-- GPX output -->
     <output-gpx>
-      <waypoint type="start" string="START" /> <!-- For the first route waypoint -->
-      <waypoint type="inter" string="INTER" /> <!-- For the intermediate route waypoints -->
+      <waypoint type="waypt" string="WAYPT" /> <!-- For the route waypoints -->
       <waypoint type="trip" string="TRIP" /> <!-- For the other route points -->
-      <waypoint type="finish" string="FINISH"/> <!-- For the last route waypoint -->
 
       <desc  text="%s route between 'start' and 'finish' waypoints" /> <!-- %s = [shortest|quickest] -->
       <name  text="%s route" /> <!-- %s = [shortest|quickest] -->
@@ -191,10 +189,8 @@
 
     <!-- GPX output -->
     <output-gpx>
-      <waypoint type="start" string="START" /> <!-- For the first route waypoint -->
-      <waypoint type="inter" string="INTER" /> <!-- For the intermediate route waypoints -->
-      <waypoint type="trip" string="TRIP" /> <!-- For the other route points -->
-      <waypoint type="finish" string="FINISH"/> <!-- For the last route waypoint -->
+      <waypoint type="waypt" string="Wegpunkt" /> <!-- For the route waypoints -->
+      <waypoint type="trip" string="Reiseroute" /> <!-- For the other route points -->
 
       <desc  text="%s Strecke zwischen 'Start' und 'Ziel'" /> <!-- %s = [shortest|quickest] -->
       <name  text="%s Strecke" /> <!-- %s = [shortest|quickest] -->
@@ -204,13 +200,13 @@
 
   </language>
 
-  <language lang="fr" language="Francais">
+  <language lang="fr" language="Français">
 
     <!-- Copyright of the data being routed, not of this file  -->
     <copyright>
       <creator string="Créateur" text="Routino - http://www.routino.org/" />
       <source  string="Source" text="Basé sur les données OpenStreetMap de http://www.openstreetmap.org/" />
-      <license string="License" text="http://www.openstreetmap.org/copyright" />
+      <license string="Licence" text="http://www.openstreetmap.org/copyright" />
     </copyright>
 
     <!-- Turn directions, 0 = ahead, -2 = left, +/-4 = behind, +2 = right -->
@@ -226,7 +222,7 @@
 
     <!-- Heading directions, 0 = North, -2 = West, +/-4 = South, +2 = East -->
     <heading direction="-4" string="Sud" />
-    <heading direction="-3" string="Dud-Ouest" />
+    <heading direction="-3" string="Sud-Ouest" />
     <heading direction="-2" string="Ouest" />
     <heading direction="-1" string="Nord-Ouest" />
     <heading direction="0"  string="Nord" />
@@ -243,7 +239,7 @@
     <ordinal number="5"  string="Cinquième" />
     <ordinal number="6"  string="Sixième" />
     <ordinal number="7"  string="Septième" />
-    <ordinal number="8"  string="huitième" />
+    <ordinal number="8"  string="Huitième" />
     <ordinal number="9"  string="Neuvième" />
     <ordinal number="10" string="Dixième" />
 
@@ -256,8 +252,8 @@
     <highway type="unclassified" string="route non classifiée" />
     <highway type="residential"  string="rue résidentielle" />
     <highway type="service"      string="rue de service" />
-    <highway type="track"        string="chemin" />
-    <highway type="cycleway"     string="voie cyclable" />
+    <highway type="track"        string="piste" />
+    <highway type="cycleway"     string="piste cyclable" />
     <highway type="path"         string="sentier" />
     <highway type="steps"        string="escalier" />
     <highway type="ferry"        string="ferry" />
@@ -268,8 +264,8 @@
 
     <!-- HTML output -->
     <output-html>
-      <waypoint type="waypoint"   string="Etape" /> <!-- For the chosen waypoints -->
-      <waypoint type="junction"   string="Croisement" /> <!-- For the interesting junctions -->
+      <waypoint type="waypoint"   string="Étape" /> <!-- For the chosen waypoints -->
+      <waypoint type="junction"   string="Intersection" /> <!-- For the interesting junctions -->
       <waypoint type="roundabout" string="rond-point" /> <!-- For roundabouts -->
 
       <title text="Itinéraire %s" /> <!-- %s = [shortest|quickest] -->
@@ -285,10 +281,8 @@
 
     <!-- GPX output -->
     <output-gpx>
-      <waypoint type="start" string="DEBUT" /> <!-- For the first route waypoint -->
-      <waypoint type="inter" string="INTER" /> <!-- For the intermediate route waypoints -->
+      <!-- TRANSLATION REQUIRED: waypoint type="waypt" string="WAYPT" / --> <!-- For the route waypoints -->
       <waypoint type="trip" string="POINT" /> <!-- For the other route points -->
-      <waypoint type="finish" string="FINAL"/> <!-- For the last route waypoint -->
 
       <desc  text="Itinéraire %s entre les étapes 'début' et 'fin'" /> <!-- %s = [shortest|quickest] -->
       <name  text="Itinéraire %s" /> <!-- %s = [shortest|quickest] -->
@@ -379,10 +373,8 @@
 
     <!-- GPX output -->
     <output-gpx>
-      <waypoint type="start" string="Indulás" /> <!-- For the first route waypoint -->
-      <!-- TRANSLATION REQUIRED: waypoint type="inter" string="INTER" / --> <!-- For the intermediate route waypoints -->
+      <!-- TRANSLATION REQUIRED: waypoint type="waypt" string="WAYPT" / --> <!-- For the route waypoints -->
       <waypoint type="trip" string="Utazás" /> <!-- For the other route points -->
-      <!-- TRANSLATION REQUIRED: waypoint type="finish" string="FINISH"/ --> <!-- For the last route waypoint -->
 
       <desc  text="%s útvonal a kezdő és utolsó pont között" /> <!-- %s = [shortest|quickest] -->
       <!-- TRANSLATION REQUIRED: name  text="%s route" / --> <!-- %s = [shortest|quickest] -->
@@ -473,10 +465,8 @@
 
     <!-- GPX output -->
     <output-gpx>
-      <waypoint type="start" string="START" /> <!-- For the first route waypoint -->
-      <waypoint type="inter" string="INTER" /> <!-- For the intermediate route waypoints -->
-      <waypoint type="trip" string="TRIP" /> <!-- For the other route points -->
-      <waypoint type="finish" string="FINISH"/> <!-- For the last route waypoint -->
+      <!-- TRANSLATION REQUIRED: waypoint type="waypt" string="WAYPT" / --> <!-- For the route waypoints -->
+      <!-- TRANSLATION REQUIRED: waypoint type="trip" string="TRIP" / --> <!-- For the other route points -->
 
       <desc  text="%s Route tussen 'Start' und 'Finish'" /> <!-- %s = [shortest|quickest] -->
       <name  text="%s Route" /> <!-- %s = [shortest|quickest] -->
@@ -567,10 +557,8 @@
 
     <!-- GPX output -->
     <output-gpx>
-      <waypoint type="start" string="START" /> <!-- For the first route waypoint -->
-      <waypoint type="inter" string="INTER" /> <!-- For the intermediate route waypoints -->
-      <waypoint type="trip" string="TRIP" /> <!-- For the other route points -->
-      <waypoint type="finish" string="KONIEC"/> <!-- For the last route waypoint -->
+      <!-- TRANSLATION REQUIRED: waypoint type="waypt" string="WAYPT" / --> <!-- For the route waypoints -->
+      <!-- TRANSLATION REQUIRED: waypoint type="trip" string="TRIP" / --> <!-- For the other route points -->
 
       <desc  text="%s trasa pomiędzy 'start' a 'koniec'" /> <!-- %s = [shortest|quickest] -->
       <name  text="%s trasa" /> <!-- %s = [shortest|quickest] -->
@@ -661,10 +649,8 @@
 
     <!-- GPX output -->
     <output-gpx>
-      <waypoint type="start" string="Старт" /> <!-- For the first route waypoint -->
-      <waypoint type="inter" string="INTER" /> <!-- For the intermediate route waypoints -->
-      <waypoint type="trip" string="TRIP" /> <!-- For the other route points -->
-      <waypoint type="finish" string="Финиш"/> <!-- For the last route waypoint -->
+      <!-- TRANSLATION REQUIRED: waypoint type="waypt" string="WAYPT" / --> <!-- For the route waypoints -->
+      <!-- TRANSLATION REQUIRED: waypoint type="trip" string="TRIP" / --> <!-- For the other route points -->
 
       <desc  text="%s маршрут от 'Старта' до 'Финиша'" /> <!-- %s = [shortest|quickest] -->
       <name  text="%s маршрут" /> <!-- %s = [shortest|quickest] -->

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/routino.git



More information about the Pkg-grass-devel mailing list