This directionsService should either be passed in as an argument or just instantiated inside the function. Otherwise it's depending on the global stat.