Refactoring run function
Removing temp files in topological sort