Finished check Distance function. still needs debugging. Also returns values to the main which are used to generate messages