add previous js code for route and directions