Improve algorithm to retrieve outputs and logs from temporary or permane...

...nt storage.