work on distance function (which still needs some debugging) and
stations function (which needs to have its Rd file updated)