Automatically add loadpaths for intermediate files

Work in progress, but good enough for some testing. Usage feedback welcome.