Small impr in performance when matching paths
Added test