Refactor run_file() to take an argument and add a main() function