Finished (not tested) implementation of subpaths