moved stored proces from distance.php into maintain.php