Improving deep folder structure performance.

Previous functionality loaded parents multiple times. The use of
recursive path finding was also quite inefficient.