refactor google directions api