added loading images & calculating distances