refactor : findRouteAndMatch should avoid imperative implementation