Sorted out the is_path_source business

This still needs some work, but its a viable solution in the short term