adding a function to get elements in a path string format