Refactoring to return path elements and params together so that required
params can be calculated