made google maps + directions into a reusable function