Added event listener for calculating distance