added some new methodes, calculateDistance and writeTextFile