Reorganized a bit and added function for effective distance